class subclass1 : public superclass
class subclass2 : public superclass
cout<<"hello "<<" "<<" "<<s1->b<<endl;
As you can see I want to create a dynamicaly alocated storage of references to a parent class each of which can then point to a child class, how ever I do not know how to extract the child class out again from that array so i may access its variable b.I am sure I am missing something small, any help would be great.
PS: I could not find a similar question, but if it exists, please redirect me, also i would like a solution that does not require me to use vector or any inbuilt pre-existing library class.
Yes, this contains stuff you don't want to use. No, you aren't required to use those things, but it's convenient for me to do, since I don't want to reimplement them. If your compiler doesn't support C++11, you may have to do a little adjusting. The code you probably want to look at is in print