Categories

Jul 16, 2019 in C++

Q:

What is Polymorphism? How is it supported by C++?

1 Answer

Jul 16, 2019

Polymorphism means that some code or operations or objects behave differently in different contexts. In C++,  following features support polymorphism.

Compile Time Polymorphism: Compile time polymorphism means compiler knows which function should be called when a polymorphic call is made.  C++ supports compiler time polymorphism by supporting features like templates, function overloading and default arguments.

Run Time Polymorphism: Run time polymorphism is supported by virtual functionsThe idea is, virtual functions are called according to the type of object pointed or referred, not according to the type of pointer or reference. In other words, virtual functions are resolved late, at runtime.

Click here to read more about C++
Click here to read more about Insurance

Related questions

Madanswer
Jul 16, 2019 in C++
Jul 16, 2019 in C++
Jul 16, 2019 in C++
...