prototype_pattern::Prototype

class Prototype

Abstract base class for the Prototype pattern.

The Prototype class defines an interface for cloning objects and displaying their details.

Subclassed by prototype_pattern::ConcretePrototype1, prototype_pattern::ConcretePrototype2

Public Functions

virtual ~Prototype() = default

Virtual destructor for proper cleanup in derived classes.

virtual std::unique_ptr<Prototype> clone() const = 0

Creates a clone of the current object.

This method is implemented by derived classes to return a copy of the current object.

Returns:

A unique pointer to the cloned object.

virtual void display() const = 0

Displays the details of the prototype.

This method is implemented by derived classes to provide a textual representation of the object.