class A{
public:
void getdata();
};
class B: public A{
public:
int x,y,z;
};
class C: public A{
public:
int x,y,z;
};
//here obj could be of class b or class c
void A::getdata(){//to input values of x,y,z
std::cin>>obj.x;
std::cin>>obj.y;
std::cin>>obj.z;
}
How can I Pass object of different class(here class B and class C) to the same getdata() function to input values of x,y,z?