I know in C# there is a way to make a variable take in values so long as they share a base class, but I'm stumped with C++. Is what I am trying to do possible?
This is what my code looks like:
class BaseClass
{
    public:
        virtual void Setup() = 0;       
        virtual void DisplayText() = 0;
};
class A: public BaseClass
{
    public:     
        void Setup();       
        void DisplayText();
};
class B: public BaseClass
{
    public:     
        void Setup();       
        void DisplayText();
};
//main.cpp
A a;
B b;
std::vector<BaseClass> vector = std::vector();
void main()
{
    vector.push_back(a);
    vector.push_back(b);
    for_each (vector.begin(), vector.end(), vector.Setup());
    return 0;
}
With what I have right now though it is giving me this error when I try running this:
IntelliSense: no instance of overloaded function
"std::vector<_Ty,_Alloc>::push_back [with _Ty=BaseClass,,Alloc=std::allocator<BaseClass>]"
matches the argument list
argument types are: (A*)
object type is: std::vector<BaseClass, std::allocator<BaseClass>>
 
     
     
     
    