Polymorphism is the ability of an object to exhibit multiple behaviors. C++ allows two types of polymorphism, Static and Dynamic. Static polymorphism happens at compile time via function overloading whereas Dynamic polymorphism is exhibited at run time via function overriding.
Continue reading “C++ – Polymorphism”
Object Oriented Software – Visitor Pattern
Visitor pattern is a behavioral pattern that allows addition of new features to a class without actually modifying the class. Visitor pattern is one way of implementing the Open/ Close principle (which is one of the SOLID principles).
Continue reading “Object Oriented Software – Visitor Pattern”
Object Oriented Software – GOF Design Patterns
Softwares are susceptible to change. A new requirement can come-up any time and the software should be able to handle this change effectively with minimum intrusion. A software that is well designed can easily adapt to these ever-changing requirements and hence a good design is of utmost importance especially when it comes to design and development of a commercial software.
Continue reading “Object Oriented Software – GOF Design Patterns”
C++ – ‘Friend’
A class or a function can be made a friend of another class in C++. A friend gets access to all the private members and protected members of the class to which it becomes a friend.
Continue reading “C++ – ‘Friend’”
C++ – Constructor
A constructor is a special member function that is automatically called when you create an instance of a class. Continue reading “C++ – Constructor”
C++ – Inheritance
The idea of inheritance implements an IS-A relationship between classes.
Continue reading “C++ – Inheritance”
C++ – Virtual Functions
When a class inherits from another class, it is possible to override the public methods of the base-class in the derived-class.
Continue reading “C++ – Virtual Functions”