Welcome to WebmasterServe!

FREE TO JOIN! Join us now to engage in informative and friendly discussions about Webmastering, SEO, SEM, Internet Marketing, Programming, Graphic Design, Online Jobs and more. What are you waiting for? Ready to join our friendly community? It takes just one minute to register.

Dismiss Notice

Join WebmasterServe Forums 
Join the discussion! Have a better idea or an opinion? It takes just one minute to register Click Here to Join

My 2 Cents Pure Virtual Functions

Discussion in 'General Programming Discussions' started by Swati Mishra, Mar 15, 2016.

  1. Swati Mishra

    Yellow Belt

    Joined:
    Dec 28, 2015
    Messages:
    644
    Ratings:
    +105 / -0
    A function with no body is called the pure virtual function. The virtual function of base class is not used. If we take the example of employee class the calc_net_salary () is never invoked. Because employee belongs to two category (confirmed /trainee), and the net salary is depends on it then the functions is derived class are always invoked. In this condition the body of virtual function may not define by the base class. This is done by adding the notation ‘=0’ to the virtual function declaration, which is described below

    Example

    Virtual int calc_net_salary () =0;
    Above function is declared as the pure virtual function.
     

Share This Page