GoConqr has a new look! Let us know what you think.

Notes

Virtual, Friend and Static Function

Rushabh Ostwal Object Oriented Programming English 1 page

Content of the notes (1)

Page 1

What is Virtual Function? How can you access this function using pointer? Explain with example.

Virtual means existing in appearance but not in reality. Polymorphism refers to the property by which objects belonging are able to respond to the same message, but in different forms.

When we use the same function name in both the classes, the function in the base class is declared as virtual using the keyword virtual preceding it's normal declaration. C++ requires pointers to objects to use the virtual function.

Example :-

#include<iostream>

Information

Description
Object Oriented Programming Note on Virtual, Friend and Static Function, created by Rushabh Ostwal on 09/05/2017.
Created by
Rushabh Ostwal
Views
1
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?