Create a `Shape` base class with a virtual `draw()` method. Derive `Circle` and `Square`. Create a `ShapeFactory` class with a static method `Shape* createShape(std::string type)`. Read a shape name, get it from the factory, and call `draw()`. Remember to `delete` the pointer.
A string representing the shape type ('Circle' or 'Square').Print 'Drawing Circle' or 'Drawing Square'.
None
Circle
Drawing Circle
The Factory Method pattern abstracts the instantiation logic, returning a derived object via a base class pointer based on an input string or condition.
#include <iostream>
#include <string>
class Shape {
public:
virtual void draw() = 0;
virtual ~Shape() {}
};
// Implement Circle, Square, and ShapeFactory
int main() {
// Read input, create shape via factory, draw, and delete
return 0;
}Embedded systems rely on efficient low-level programming to interact directly with hardware. In this course, you will learn how to write practical Embedded C programs used in real microcontroller-based systems. Rather than focusing only on theory, this course follows a practice-driven approach. Each lesson includes hands-on coding exercises that simulate real firmware development tasks used