Monday, July 3, 2023

C++ : Pointers and Reference

 Demo to illustrate use of pointers and reference when passed as parameter to a function

Example : https://github.com/puthukkudi/PointersAndReference.git

C++ : Adapter Pattern

The adapter pattern convert the interface of a class into another interface clients expect. Adapter lets classes work together that couldn’t otherwise because of incompatible interfaces.


Examplehttps://github.com/puthukkudi/AdapterPattern.git

Sunday, July 2, 2023

C++: Abstract Factory Pattern

Abstract Factory design pattern is one of the Creational pattern. Abstract Factory pattern is almost similar to Factory Pattern and is considered as another layer of abstraction over factory pattern. Abstract Factory patterns work around a super-factory which creates other factories.

Abstract factory pattern implementation provides us with a framework that allows us to create objects that follow a general pattern. So at runtime, the abstract factory is coupled with any desired concrete factory which can create objects of the desired type.


Example :


In Factory pattern example we had vehicle factory to create car and bike object.Now in Abstract factory pattern we introduce one more level where client ask vehicle factory to create either TATA car or Toyota Car. Similarly it cas ask to create TATA bike or Toyota bike.


https://github.com/puthukkudi/AbstractFactoryPattern.git




Saturday, July 1, 2023

C++ : Factory Pattern

  •  Factory Pattern comes under creational pattern.
  • It provides a way of creating the object without exposing the creation logic to the client.

Example : Vehicle library for the client