Question about inherritance

Suppose a class named Tiger is derived from both the Felis class and the Carnivore class.
Here is the first line of the Tiger class declaration:
class Tiger : public Felis, public Carnivore
Here is the function header for the Tiger constructor:
Tiger(int x, int y) : Carnivore(x), Felis(y)
Which base class constructor is called first, Carnivore or Felis?

I'm confusing about this question.
I think the Felis will called first because it declare before the Carnivore in
class Tiger : public Felis, public Carnivore

Can you tell me am I correct? If not can you tell me how can I figure out who will called first?
Last edited on
I think the Felis will called first because it declare before the Carnivore in
class Tiger : public Felis, public Carnivore


I am going to vote for Carnivore first, then Felis because that is the order in the member initialization list. I was looking in the standard, I managed to find something that referred to the member initialization list being evaluated as an expression. Section 12.6.2 Initializing bases and members, note 7.

The question is, why does this matter for you? I would worry about a design which depends on this.
Topic archived. No new replies allowed.