Jump to content

accessing the function of a super class


photo

Recommended Posts

supposing I have overridden a function in a subclass is there anyway I can access the superfunctions version of the function. In D I would use the super qualifier.

 

class foo {

  void do_thing() {
      // do default stuff
   }
};

class bar : foo {
  void do_thing() {
     //handle special case
    //then handle the general case
     super.do_thing();
  }
};

Link to comment

Use <base class name>::<overridden function name> syntax

 

class foo {

  void do_thing() {
  	// do default stuff
   }
};

class bar : foo {
  void do_thing() {
     //handle special case
 	//then handle the general case
 	foo::do_thing();
  }
};

Link to comment
×
×
  • Create New...