dimanche 29 mars 2015

does the value of pointers change if exception occurs during assignment?


Consider the following code where pb is a member of class myclass:



myclass& operator=(const myclass& rhs){
myclass *pOrig = pb;
pb = new myclass(*rhs.pb); //exception occurs here .
delete pOrig;
return *this;
}


Will the value of pb remain the same or will it change ? Explain.




Aucun commentaire:

Enregistrer un commentaire