Design Patterns - Singleton Pattern | Explanation and Implementation in C++
►Software Design and Design Patterns Playlist: • C++ Software Design and Design Patterns ►Find full courses on: https://courses.mshah.io/ ►Join as Member to Support the channel: / @mikeshah ►Git Repo: https://github.com/MikeShah/DesignPat... ►Lesson Description: In this lesson I show you how to implement a creational design pattern in C++ known as the singleton. This is a controversial pattern to many in that it can be misused, however, the pattern itself can be useful when we truly need only 1 point of access for a specific class (e.g., a file system or logger). This lesson will also refresh you on the idea of 'static' which is a clean way to implement the singleton pattern. Useful resource on understanding static https://en.cppreference.com/w/cpp/lan... 00:00 Design Patterns are not perfect 00:58 Creational Design Pattern 2:25 Sample Logger Class 4:10 Creating multiple instances of an object 5:15 Utilizing access modifiers of class for constructor 6:06 Idea of a GetInstance member function 7:06 The static keyword 7:50 static function example 10:22 Practical use case of static in a class 11:00 Initializing static member variables 13:30 A static pointer to instance of our class as member variable 15:40 Utilizing a member function from our single instance 16:50 Creating a static member function 17:37 Implementing our logger class 19:10 Allocating memory for our pointer 20:50 Adding messages to our logger 22:18 Careful with returning pointers to member variables 24:20 Design to protect your clients of your API 25:10 Create the static variable within GetInstance 27:30 Other design considerations and closing ►YouTube Channel: / mikeshah ►Please like and subscribe to help the channel! ►Join our free community: https://courses.mshah.io/communities/...

Design Patterns - Factory Method Pattern Explanation and Implementation in C++

Design Patterns - Command Pattern Explanation and Implementation in C++

Singleton Design Pattern | C++ Example

Why I Don't Like Singletons

Design Patterns - Iterator Pattern Explanation and usage with STL in C++

Singleton Pattern - Design Patterns

SINGLETONS in C++

C++ Strategy Design Pattern - Part 1 of 2 - Changing Algorithmic Behavior

Union types in C# | DEM304

Why I love and hate C++

The Observer Design Pattern in C++ - Part 1 of n - A simple implementation

7 Design Patterns EVERY Developer Should Know

Retiring the Singleton Pattern - Peter Muldoon - Meeting C++ 2019

C++ Tutorial: the factory design pattern

Exception handling in C++ (How to handle errors in your program?)

Design Patterns - The Extensible Factory Pattern in C++ | Register Objects at Runtime

How To Think SO CLEARLY People Assume You're A Genius

Design Patterns - Factory Method Pattern Adding More Power to Count Allocated Objects in C++

