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

0

1 Answer 1

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();
  }
};
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.