हिंदी
तमिलनाडु बोर्ड ऑफ सेकेंडरी एज्युकेशनएचएससी विज्ञान कक्षा ११

Answer the question based on the following program. What types of operands are used for the overloaded operator?

Advertisements
Advertisements

प्रश्न

Answer the question based on the following program.

#include<iostream>
#include<string.h>
using namespace std;
class comp {
public:
char s[10];
void getstring(char str[10])
{ strcpy(s,str); }
void operator==(comp);
};
void comp::operator==(comp ob)
{ if(strcmp(s,ob.s)==0)
cout<<"\nStrings are Equal";
else
cout<<"\nStrings are not Equal"; }
int main()
{ comp ob, ob1;
char string1[10], string2[10];
cout<<"Enter First String:";
cin>>string1;
ob.getstring(string1);
cout<<"\nEnter Second String:";
cin>>string2;
ob1.getstring(string2);
ob==ob1;
return 0; }

What types of operands are used for the overloaded operator?

एक पंक्ति में उत्तर
Advertisements

उत्तर

User-defined data type class (comp) objects are used.

shaalaa.com
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 15: Polymorphism - Evaluation - Section - D [पृष्ठ २५९]

APPEARS IN

सामाचीर कलवी Computer Science [English] Class 11 TN Board
अध्याय 15 Polymorphism
Evaluation - Section - D | Q 4. (v) | पृष्ठ २५९
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×