Zack
Zack

Reputation: 1235

Constructor initialization confusion

I am new to C++ and came across the following constructor.

Node::Node(
    Po * po, const TP & tn, const Des& descs)
  : BNode("Node", TJ::INNER_J, po, tn, descs) {
}
  1. Why is there no keyword such as private, or public before BNode?
  2. Does this mean we use Node constructor to initialize BNode?

BNode is a class.

Let me know if you need more info.

Upvotes: 0

Views: 59

Answers (1)

Neil Kirk
Neil Kirk

Reputation: 21773

  1. If BNode is a base class, whether it is private or public has already been declared in the class definition.
  2. Yes. This is calling the constructor of BNode, which will happen during the constructor for Node.

Upvotes: 3

Related Questions