A has a static function A :: create (), which creates an instance of A, does some initialization, and returns a pointer to it. I want to create a subclass of A and have a similar create () function:
class B : public A { public: static B* create(); int val;
in this B :: create () function, I need to do the following:
B* B::create() { auto b = (B*)A::create(); b -> val = 0; //... return b; }
Is this right to do? What will happen after the broadcast?
Subsequent actions: A has a protected / closed constructor. How do I write B :: create () or constructor B? I want the vars inherited from A to have the same values ββas the created A :: create () would have
source share