returning a struct/class, and destructors
If a function returns a class (not as a reference/pointer), are destructors called for the stuff on the stack?
Code:
class Bwah{
public:
int x;
Bwah():
x(0) {}
~Bwah(){
cout << "x : " << x << endl;
}
};
class Assigner{
public:
static Bwah boo(){
Bwah bwah;
return bwah;
}
};
int main () {
{
Bwah boo = Assigner::boo();
cout << "got here.." << endl;
}
}
In that example, the destructor only gets called once, after "got here". Where can I read more about this stuff?