Minggu, 09 April 2017

How to work with virtual functions in C++

We know that when a base class pointer refers to a derived class object, the extra features in derived class are not available. To access the extra features in the derived class, we make the functions in the base class as virtual. Syntax for creating a virtual function is as follows: The Following is the syntax for Virtual Function in C++ 1 2 3 4 5 virtual return–type function–name(params–list) { //Body of function ... }   A class which contains one or more virtual functions is known as a polymorphic class. Following program demonstrates accessing derived class features using virtual

The post How to work with virtual functions in C++ appeared first on Coding Security.


How to work with virtual functions in C++
read more

Tidak ada komentar:

Posting Komentar