I have the following program:
class A
{
string s;
public:
A(const string& a) : s(a) { cout << s << endl; }
};
class B : public A
{
public:
B(const string& b) : A(b) { }
};
class C : public B
{
public:
C() : B(string("ABC")) { }
};
int main(int argc, char *argv)
{
unsigned char i = 0;
C* c = new C;
delete c;
}
/////////////////////////////////////////////////////////
If I put the delete c statement in comment, valgrind will report that
I'm leaking c AND the string temporary created when invoking B ctor.
why ?
I would have expected that the temporary would be destroyed after c
was created, not haning there until I destroy c.
_______________________________________________
help-gplusplus mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gplusplus