Quick question about inheritance

In all the examples I have see or code I've wrote, there seems to be one parent class and the children stemming from that. Can a child class inherit from more than one parent class without routing the second parent through the immediate parent.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
class Parent
{
   // blahblah
}

class Parent2
{
   // blahblah2
}

class Child: Parent: Parent2
{
   // blahblah
}
Yes of course, use a comma:

1
2
3
class Child : public Parent, public Parent2 
{
};
Last edited on
Thankyou
Topic archived. No new replies allowed.