So "virtual void attack() = 0" = "virtual void attack(){}"? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

So "virtual void attack() = 0" = "virtual void attack(){}"?

5th Jan 2016, 2:18 AM
Yangmo Zhu
Yangmo Zhu - avatar
2 Answers
+ 1
A big NO. virtual void attack() =0; is a pure virtual function. It can not have a definition. virtual void attack(){} is not pure virtual function. it may have definition.
9th Apr 2016, 5:49 PM
Abhishek Jain
Abhishek Jain - avatar
0
no. virtual mean that derived class must implement our virtual function. base class have only info that our function have specific type and name , no implementation.
11th Jan 2016, 10:30 PM
Zbigniew Ignasiak
Zbigniew Ignasiak - avatar