You will have to forgive me if this is really a basic question; I haven't used C ++ for a long time, so I forgot how much it works.
Anyway, I have a base class and a couple of derived classes like this (super simplistic, but the essence is the same):
class Base
{
public:
Base () { }
int SomeFunction (int x, int y);
};
class Derived1 : public Base
{
public:
Derived1() : Base() { }
int SomeFunction (int x, int y)
{
return 4;
}
};
class Derived2 : public Base
{
public:
Derived2() : Base() { }
int SomeFunction (int x, int y)
{
return 7;
}
};
Later in mainI have a list of objects Base:
Base *baseobjects[10];
Later I populate this array with instances of Derived1and Derived2. This works with baseobjects[i] = &newDerived1(where newDerived1is an instance of the class Derived1). This is all wonderful.
, , , baseobjects SomeFunction , , . #, , , -, ++ :
int result = baseobjects[i]->SomeFunction(a, b);
LNK2019 , -, , Base , . , , , , , . ?