Can any body explain the difference between virtual method and pure virtual method in detail and differences?
Hi Sudheer,
If pure virtual functions are not overridden by child class then it’s an implementation error i.e
if you have an abstract class with pure virtual function method then you have to override the function in child class but for virtual function you may or may not override the method from child class.
Thanks,
Vikas Billa
This is explained in section 8.21 Abstract classes and pure virtual methods of the 1800-2012 LRM. Get a copy of it, it’s free. This section was missing from earlier versions of the LRM.
In reply to dave_59:
Can you please update the link.On clicking comes, Page not found
Hi Dave,
The “Download PDF” option is disabled for me even though I have logged into my IEEE account. How can I download the document ?
Thanks!
In reply to Saraswati:
The IEEE Get Program does not require an IEEE account.
I read the section (8.21) as Dave mentioned from LRM.
It says…
A virtual method in an abstract class may be declared as a prototype without providing an implementation. This is called a pure virtual method and shall be indicated with the keyword pure together with not providing a method body. An extended subclass may provide an implementation by overriding the pure virtual method with a virtual method having a method body.
Does this mean pure virtual method can only exist in abstract class?
In reply to bharat_vg:
A pure virtual method only exists in an abstract class or an interface class. An interface class is a special case of an abstract class that contains only pure virtual methods and nothing else.