You are here:

C++/Function Overriding



My question is, when you override the parent and then you use the virtual function. What functionality or what is the exact action will be taken. Is it from the override or the parent's?

Please advice. Thanks!

When you override a function (or operator) of the parent class, the derived (child) class' function is called when the object (of type child) is called.  If you want to use the parent's functionality and add to it, or preprocess before it, you can call the parent member function (Parent::function()) in the member function of the child.



All Answers

Answers by Expert:

Ask Experts


Bill A


I can answer questions about C++, programming algorithms, Windows programming in MFC (which is C++). I cannot answer questions about STL (templates) and I have no experience with Linux. I do enjoy reviewing code and critiquing it or finding problems in it. I will also gladly show better algorithms or methods if you want to take advantage of that.


I've developed a commercial embedded C compiler/assembler and IDE with debugger toolset, of which the IDE and debugger are written in C++. I work in the industry writing high tech embedded programs and Windows programs to communicate with the embedded devices.

Book: Embedded Systems Design using the Rabbit 3000 Microprocessor Authored Chapter 10 in its entirety.

BS Computer Engineering

©2017 All rights reserved.