Hello,
This is probably a simple question.
I have a class A, and a class B, class C class... which inherits from class A.
Now I want to store it in a container e.g. vector
vector<*A> container;
I have also created some objects of B and C, and stored it in the container
B b;
C c;
container.push_back(&b);
container.push_back(&c);
Now for my question, I have overloaded << which take b, or c and print whatever it contains. Is it possible to fetch b, and c from the container so I can use <<?
As of now I have to written a print() function, which I call by
(*it)->print();
to print the information in the object. But is it possible to fetch from the container so I can use the overloaded << instead?