1

just asking what can I put instead of super.draw() to call the parent class function within the overriding function?

class base {
    void draw() {
    }
}
class derived {
    void draw() {
    super.draw();
    }
}

I know that for constructors the base constructor is automatically called at the derived constructor, I want basically the same thing for other methods. thanks

1 Answers1

1

First dervied needs to derived from base so that you can access its methods. Qualifying the call with base:: will make the compiler look for the base class:

class derived : public base {
  void draw() {
    base::draw();
  }
};
David G
  • 94,763
  • 41
  • 167
  • 253