prototype_pattern::ConcretePrototype1
-
class ConcretePrototype1 : public prototype_pattern::Prototype
A concrete implementation of the Prototype interface.
ConcretePrototype1 represents a specific prototype with a string attribute.
Public Functions
-
explicit ConcretePrototype1(const std::string &attribute)
Constructor to initialize the attribute.
- Parameters:
attribute – The value to initialize the prototype’s attribute.
-
virtual std::unique_ptr<Prototype> clone() const override
Creates a clone of the current object.
Creates a clone of the ConcretePrototype1 object.
This method is implemented by derived classes to return a copy of the current object.
Creates a new instance of ConcretePrototype1 by copying the current object’s attribute.
Performs a deep copy of the current object, creating an independent instance.
- Returns:
A unique pointer to the cloned object.
- Returns:
A unique pointer to the cloned ConcretePrototype1.
-
virtual void display() const override
Displays the details of the prototype.
Displays the details of the ConcretePrototype1.
This method is implemented by derived classes to provide a textual representation of the object.
Outputs the value of the attribute.
Outputs the value of the attribute to the standard output.
-
explicit ConcretePrototype1(const std::string &attribute)