I've the following classes :
class A{
int x;
int y;
int z;
public:
int getX();
int getY();
int getZ();
//...
}
class B{
int x;
int y;
int z;
double rotation;
}
class C{
int x;
int y;
int z;
double dir;
double index;
}
classes B and C have class A parameters in common, Is it good practice to inherit from class A or using composite and storing an A object in B and C classes?
when inheriting from A class it's not necessary to re-implement A functions for B and C but everyone says that composite is better than inheritance! so which one is better?
Edit: suppose both conditions: is-a relation and otherwise, suppose I've class "Point" as "A" class mentioned and I've a gps data which has latitude, longitude and elevation and in some classes I want to add some coordinate information to it. it is not clear that gps data is a point or has a point!