2009/05/24

Virtual function: Differences between C++ and Java

 Purposes: Polymorphism (Dynamic Binding)

C++ Java
Pure Virtual Function vitual void func() = 0; abstarct void func();
Impure Virtual Function vitual void func(); void func();
Non-Virtual Function void func(); final void func();
Hiding Inherited Names Yes No
Prohibiting Inheritance No final class


Reference:
[1] Wiki_Virtual Function
[2] Effective C++
[3] Override Hiding and Overloading

No comments:

Post a Comment