+ 2

what does it mean that a pure virtual function has no body?

and why cant it have a body?

29th Jun 2017, 8:49 PM
koala 🐨
koala 🐨 - avatar
1 Réponse
+ 13
It can't have a body partially because that is how it's defined.... but that's too circular to be useful. Why would you do that? To provide a safe set of methods that other classes know they can call on subclasses of the abstract class can call. Then, you make fully fleshed out subclasses that are interchangeable so you can compare solutions, or switch the type of calculations you're doing depending on the situation.
30th Jun 2017, 12:12 AM
Jim
Jim - avatar