So basically I am trying to figure out a way of creating array where each element could be a different type (I am creating an Equipemnt which contains all items owned by player where each item is separate class) Each of classes (B,C,D) has one method of exactly same name which is used when particular tab[] element is clicked onto.
Unfortunately trying to use union did not solve my problem.
Example:
union A
{
B b;
C c;
D d
}
A tab[3];
tab[0]=B item1(a,b,c,...);
tab[1]=C item2;
tab[2]=D item3;
Use std::variant type like
std::vector<std::variant<B, C, D>>