From the course: C++ Design Patterns: Creational

Unlock the full course today

Join today to access over 24,700 courses taught by industry experts.

Abstract Factory pattern implementation

Abstract Factory pattern implementation - Visual Studio Express Tutorial

From the course: C++ Design Patterns: Creational

Abstract Factory pattern implementation

- [Instructor] The AbstractFactory's designs goal is to have different concrete factories creating similar objects. But the exact construction of the objects are defined differently by each factory, which allows objects that belong in the same suite or family to be kept together. For this implementation, I'm going to create two car factories, one for a gas powered car, and one for an electric car. The gas powered car factory will have its own implementation of a car door and its own gas powered engine. And the electric car factory will have its own implementation of a car door and its own electric engine. To help us get started, I'll have created these products ahead of time; the doors and the engines. And we'll focus on creating the factories for this example. I've opened 04_02_AbFacImp_Start. We have already implemented my base door class at line 10. It has a public method cut open that will be overrided by the…

Contents