class Nclass : public Zclass {
public:
explicit Nclass();
Nclass(const Nclass& a);
virtual ~Nclass() {};
virtualvoid f1(...); //this allocates memory for a rel and puts it on h_rel
virtualbool f2(...)=0;
private:
Heap<rel> h_rel;
};
Pclass::f1(...)
{
...
Nclass::f1();
...
}
My questions are:
1. How can Pclass::f1() directly call Nclass::f1 without instantiating an Nclass explicitly?
2. I set a breakpoint in gdb on Nclass::~Nclass and it was not hit - is that expected?
3. It looks like a new NClass is being generated each time Pclass::f1() is called (I set a breakpoint in gdb and saw that the "this pointer" changes. Where is the new NClass being deallocated.
1_ Pclass is an Nclass. Line 11 is calling the member function as defined in the parent class
3_ Nope, you are not creating another Nclass objects. As for this changing, show how did you measure that.
OK, thanks so much - its a bit convulated bit ultimately there is a new without a delete.
As for #3, this "creation of NClass" was just my bad understanding of some gdb output.