Write an operator overloading program to write S3+=S2.
Answers were Sorted based on User's Feedback
Answer / som shekhar
class A
{
int id;
public:
A& operator +(const A& a1)
{
A a;
a.id = id + a1.id;
return a;
}
A & operator =(const A& a1)
{
if( this == &a1)
return;
else
{
A a;
a.id = a1.id;
return a;
}
}
};
S3 += S2 internaly will be called as
S3->operator=(s3->operator+(s2));
In this case first + operator will be called and then
assignment operator will be called.
Is This Answer Correct ? | 0 Yes | 1 No |
what uses of c++ language?
Does c++ support multilevel and multiple inheritance?
What is virtual destructor? Why?
3 Answers Agile Software, College School Exams Tests, CSC,
what is costructor?
What is encapsulation and abstraction? How are they implemented in C++?
0 Answers Agilent, ZS Associates,
Can we create object of class with private constructor?
write a program which best describes polymorphism in real world?
2 Answers CTS, Infosys, NexGen,
what is multi level inheritance give n example ?
13 Answers HDFC, Hulas Steel, Ness Technologies,
What is R T T I ?
which is best institute to learn c,c++ in ameerpet hyderabad
I have One image (means a group photo ) how to split the faces only from the image?............ please send the answer nagadurgaraju@gmail.com thanks in advace...
is there any choice in opting subjects like 4 out of 7