Design Pattern Examples
Overview of object-oriented design patterns
EntryInformation Struct Reference

Represents an individual with a Name, Age, and Height. More...

#include <Strategy_EntryInformation.h>

Collaboration diagram for EntryInformation:
Collaboration graph

Public Types

using shared_ptr_t = std::shared_ptr< EntryInformation >
 Alias to make it easier to work with a shared pointer.
 

Public Member Functions

 EntryInformation (std::string name, int age, int height)
 Constructor.
 
std::string ToString ()
 Convert the entry into a string. In this case, a formatted string where name, age, and height are confined to columns.
 

Public Attributes

std::string Name
 Name of this individual.
 
int Age
 Age of this individual, in years.
 
int Height
 Height of this individual, in inches.
 

Detailed Description

Represents an individual with a Name, Age, and Height.

Definition at line 21 of file Strategy_EntryInformation.h.

Member Typedef Documentation

◆ shared_ptr_t

using shared_ptr_t = std::shared_ptr<EntryInformation>

Alias to make it easier to work with a shared pointer.

Definition at line 26 of file Strategy_EntryInformation.h.

Constructor & Destructor Documentation

◆ EntryInformation()

EntryInformation ( std::string  name,
int  age,
int  height 
)
inline

Constructor.

Parameters
nameName of the individual.
ageAge of the individual (in years).
heightHeight of the individual (in inches).

Definition at line 49 of file Strategy_EntryInformation.h.

Member Function Documentation

◆ ToString()

std::string ToString ( )
inline

Convert the entry into a string. In this case, a formatted string where name, age, and height are confined to columns.

Returns

Definition at line 62 of file Strategy_EntryInformation.h.

References EntryInformation::Age, Helpers::formatstring(), EntryInformation::Height, and EntryInformation::Name.

Member Data Documentation

◆ Age

int Age

Age of this individual, in years.

Definition at line 36 of file Strategy_EntryInformation.h.

Referenced by Strategy_SortEntries_ByAge::Sort(), and EntryInformation::ToString().

◆ Height

int Height

Height of this individual, in inches.

Definition at line 41 of file Strategy_EntryInformation.h.

Referenced by Strategy_SortEntries_ByHeight::Sort(), and EntryInformation::ToString().

◆ Name

std::string Name

The documentation for this struct was generated from the following file: