Saturday, November 30, 2013

Polymorphism in C++

Simple Note

From reference:

One of the key features of derived classes is that a pointer to a derived class is type-compatible with a pointer to its base class. Polymorphism is the art of taking advantage of this simple but powerful and versatile feature, that brings Object Oriented Methodologies to its full potential.

Also refer to http://ben-bai.blogspot.tw/2013/11/virtual-keyword-in-c.html

Tested with Dev-C++ 4.9.9.2

Code

https://github.com/benbai123/C_Cplusplus_Practice/blob/master/CPP/CPP_Basic/CPP_Extend_and_scope/polymorphism/basic/polymorphism_basic.cpp

Result

Refer to http://ben-bai.blogspot.tw/2013/11/virtual-keyword-in-c.html

Reference

http://www.cplusplus.com/doc/tutorial/polymorphism/

No comments:

Post a Comment