Design Patterns in C++ Flashcards

1
Q

Types of design patterns

A
  1. Creational
  2. Behavioral
  3. Structural
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Factory design pattern

A
It creates objects for you rather than you creating objects. It is also known as Virtual Constructor.
Define an interface or an abstract class for creating an object but let the subclass decide which class to initiate.
Creating objects at runtime.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Abstract Factory design pattern

A

AFDP defines an abstract class for creating families of related objects but without specifying their concrete sub-class. You need system to be independent of how objects are created, composed and represented. Show interface not implementation.System need to be configured with one of the multiple family of objects.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Singleton pattern

A
Define a class that has only one instance and provide a global point of access to that instance. Save memory, flexible and single point of access. Eg: threadpool, database application, configuration settings.
How to implement: 1.static member 2.private constructor 3.Static function
How well did you know this?
1
Not at all
2
3
4
5
Perfectly