

















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The concept of assignment operator and its implementation in a string class in object-oriented programming (oop). It also covers the topic of operator overloading, focusing on the + operator and its various definitions for complex numbers. The implications of friend functions and their limited use in encapsulation.
Typology: Exercises
1 / 25
This page cannot be seen from the preview
Don't miss anything!


















&^ String
operator
=^ (const
String
rhs){
size
=^ rhs.size; delete
bufferPtr; if(rhs.size
bufferPtr
=^ new
char[rhs.size+1];
strcpy(bufferPtr,rhs.bufferPtr);} else^ bufferPtr
return
*this;
main(){String
str1(“AB"); String
str2(“CD”),
str3(“EF”);
str
=^ str2; str
=^ str
=^ str3;
Now
valid…
… // size = rhs.size;// delete [] bufferPtr;…
Fakhir