0

What is difference between REDEFINING and OVERRIDING in C++?

I am confused about the differences between redefining and overriding functions in derived classes. Please explain simply in your own words!

13th Apr 2018, 2:54 AM
Waqas Ahmed
Waqas Ahmed - avatar
1 Resposta
+ 3
Overriding: The method in the ancestor class is virtual. A new implementation overrides the virtual one. Redefining: The method in the ancestor class isn't virtual. Therefore the compiler has to choose which method gets used at compiletime. You should avoid this.
13th Apr 2018, 3:51 AM
Alex
Alex - avatar