#include "iostream.h"
#include "conio.h"
#include "string.h"
class string
{
char str[20];
public:
string(char s[])
{
strcpy(str,s);
}
void print()
{
cout<<"\n"<
}
int operator==(string s)
{
if(strcmp(str,s.str)==0)
return 1;
else
return 0;
}
};
void main()
{ clrscr();
string s1("Overloading"),s2("Overloading");int res;
if(s1==s2)
cout<<"\nSame String";
else
cout<<"\nDifferent String";
}
Output
Same String
0 comments:
Post a Comment