C++ : pure virtual function | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

C++ : pure virtual function

Why do we need pure virtual functions when we can have empty body functions {}

28th Mar 2017, 2:54 PM
Parsa
Parsa - avatar
1 Answer
+ 11
PURE VIRTUAL FUNCTION is declared as : Eg: virtual return_type function_name(function argument)=0; The =0 tells the compiler that function has no body this virtual function will be called Pure virtual Function. https://stackoverflow.com/questions/15075581/c-difference-between-virtual-0-and-empty-function
14th Jun 2018, 5:18 PM
Rstar
Rstar - avatar