N
Naren
Please tell me which of this is correct.
class B
{
A a;
public:
B(){a.Doif();}
~B(){a.Doelse();}
};
class B
{
A* a;
public:
B():a(new A) {a->Doif();}
~B(){a->Doelse();delete a;}
};
Second one will always work.
Is first one undefined, though I have verified that both works correctly.
Application created using Microsoft compiler.
Thanks in advance.
Thanks,
Naren.
class B
{
A a;
public:
B(){a.Doif();}
~B(){a.Doelse();}
};
class B
{
A* a;
public:
B():a(new A) {a->Doif();}
~B(){a->Doelse();delete a;}
};
Second one will always work.
Is first one undefined, though I have verified that both works correctly.
Application created using Microsoft compiler.
Thanks in advance.
Thanks,
Naren.