Skip to main content
added 2 characters in body
Source Link
Łukasz W.
  • 9.8k
  • 5
  • 40
  • 65

The first is a class which base is qwe. The second is the same but it also have constructor that executes specified constructor (with diffrent arguments then default one) from base class while being invoked.

Second snippet shows how to handle the situation when base class do not have default constructor. The reason of that requirement is that inheritor'sderived class constructor is always calling base class constructor first. If base constructor needs some parameters then you have to call it explicetely.

The first is a class which base is qwe. The second is the same but it also have constructor that executes specified constructor (with diffrent arguments then default one) from base class while being invoked.

Second snippet shows how to handle the situation when base class do not have default constructor. The reason of that requirement is that inheritor's constructor is always calling base class constructor first. If base constructor needs some parameters then you have to call it explicetely.

The first is a class which base is qwe. The second is the same but it also have constructor that executes specified constructor (with diffrent arguments then default one) from base class while being invoked.

Second snippet shows how to handle the situation when base class do not have default constructor. The reason of that requirement is that derived class constructor is always calling base class constructor first. If base constructor needs some parameters then you have to call it explicetely.

Source Link
Łukasz W.
  • 9.8k
  • 5
  • 40
  • 65

The first is a class which base is qwe. The second is the same but it also have constructor that executes specified constructor (with diffrent arguments then default one) from base class while being invoked.

Second snippet shows how to handle the situation when base class do not have default constructor. The reason of that requirement is that inheritor's constructor is always calling base class constructor first. If base constructor needs some parameters then you have to call it explicetely.