About inherited classes

Let's say we have a class B which is inherited from A.

I want to use some functions of A and I want to redefine some functions of A in B. The question is, can I change the functions of A in class B by redefining those functions in B? I guess that these functions will be overloaded, right?

Thank you very much,
Last edited on
Last edited on
closed account (48T7M4Gy)
The short answer is yes. This reference might add to the wealth of info from p007
http://www.cplusplus.com/doc/tutorial/inheritance/


Virtual functions are what you're looking for. They basically allow you to write over an existing function. Say you have class b and you run a function from class a which uses a virtual function also from class a - if you write over this virtual function in b it will then use that, even though you're initially calling a class a function.
Topic archived. No new replies allowed.