Virtual methods are used to use the polymorhism feature in C++. Say class A is inherited from class B. If we declare say fuction f() as virtual in class B and override the:Virtual metod concept is not supported in java.In c++ if one class extends more then one class then there is a probability of getting more then one method in a single class which may lead to ambiguity. Inorder to avoid this just put the keyword virtual before the method then that method is called as a virtual method
Category:Java Interview Questions
No comments:
Post a Comment