Polymorphism is one of the key features of object orientation. It means many forms or single interface multiple implementations. Polymorphism is of two types: 1) Compile-time polymorphism and 2) Run-time polymorphism as illustrated in the following figure: Function Overriding When a base class and sub class contains a function with the same signature, and the function is called with base class object, then the function in derived class executes and the function in base class is said to be overridden. This is known as function overriding. Following program demonstrates function overriding: 1 2 3 4 5 6 7 8
The post A Brief Introduction to polymorphism in C++ appeared first on Coding Security.
A Brief Introduction to polymorphism in C++
read more
Tidak ada komentar:
Posting Komentar