0

What is a virtual function and how it works?

c++

27th Nov 2016, 9:22 AM
Akshay V
Akshay V - avatar
2 Antworten
+ 1
more to answer of sunil yadav, the most important thing is that the class which has a virtual function is abstract class, means we can not made an object for that class! yes it is strange, and dont forget that every class must do at least on job for us, and the duty of abstract class is defining virtual function, which could be used by other classes! other classe can use the name and body of virtual function for themselves.
27th Nov 2016, 1:32 PM
parisa
parisa - avatar
0
It's is Just Function without Having Body. It uses Keyword "Virtual" Prior to Func_Name Whole Definition Is Given In Another Class Or Derived Class. Virtual Class Is Grabing the Polymorphism Feature, as Defining Function In Derived Class With Same Name But Different No. of Parameters Will Give Freedom to Use Same Named Function for Different Task And Operations. virtual func()=0;
27th Nov 2016, 10:02 AM
Sunil Yadav
Sunil Yadav - avatar