Silly question here, but I can't seem to find a clear answer because of my lack of experience with terminology. Say I have a class
Class Char
{
friend void function(Char object);
protected:
float x, y;
};
void function(Char object){
// access object.x and object.y
}
And that class has several child classes:
Class Char1 : public Char
{
...
};
Class Char2 : public Char
{
...
};
Is it possible to use a Char1
or Char2
object as a parameter for function(Char object)
, since they both inherit the values that the function will use?
Thanks and sorry for the silly question