मराठी
तामिळनाडू बोर्ड ऑफ सेकेंडरी एज्युकेशनएचएससी विज्ञान इयत्ता ११

Answer the question based on the following program. Write out the prototype of the overloaded member function.

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; }

Write out the prototype of the overloaded member function.

एका वाक्यात उत्तर
Advertisements

उत्तर

The prototype of the overloaded member function is as follows:
void comp::operator==(comp);

shaalaa.com
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 15: Polymorphism - Evaluation - Section - D [पृष्ठ २५९]

APPEARS IN

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

Englishहिंदीमराठी


      Forgot password?
Use app×