Jump to content

super constructor


photo

Recommended Posts

Posted

Hello,

 

I couldn't find anything in the documentation regarding super constructors.

 

I've been using:

 


class Foo{};
class Bar : Foo{
  Bar(){
     Foo::__Foo__(); // call super constructor
  }
};

 

Is this the correct way to do this?

 

 

 

 

Michael

Posted

like this

class Foo {};
class Bar : Foo {
   Bar() {
       __Foo__(); // call super constructor-
   }
}; 

Posted

Aha! You are correct :) Thank you.

Interestingly, my method will compile, though I am unsure of what results from it.

×
×
  • Create New...