Ex8.* feedback: syntactic sugar
This commit is contained in:
parent
815e771d7d
commit
6d63474276
3 changed files with 7 additions and 7 deletions
|
@ -36,7 +36,7 @@ public:
|
|||
private:
|
||||
string _name ;
|
||||
double _salary ;
|
||||
set<Employee*> _subordinates ;// subordinates is an unordered collection so set is usefull enough
|
||||
set<Employee*> _subordinates ;// subordinates is an unordered collection of unique people so set is usefull enough
|
||||
|
||||
} ;
|
||||
|
||||
|
|
|
@ -10,15 +10,15 @@ void populate_directory( set<Employee*>& directory ) {
|
|||
Manager* jo = new Manager("Jo", 5);
|
||||
Manager* frank = new Manager("Frank", 6);
|
||||
|
||||
(*stan).addSubordinate( *wouter );
|
||||
(*stan).addSubordinate( *ivo );
|
||||
stan->addSubordinate( *wouter );
|
||||
stan->addSubordinate( *ivo );
|
||||
|
||||
directory.insert( stan );
|
||||
directory.insert( wouter );
|
||||
|
||||
// This does not give a problem because stan is also of type Employee
|
||||
(*frank).addSubordinate( *stan );
|
||||
(*frank).addSubordinate( *jo );
|
||||
frank->addSubordinate( *stan );
|
||||
frank->addSubordinate( *jo );
|
||||
|
||||
directory.insert( wouter );
|
||||
directory.insert( ivo );
|
||||
|
|
|
@ -9,7 +9,7 @@ class Circle: public Shape {
|
|||
public:
|
||||
|
||||
// Constructor, destructor
|
||||
Circle(int radius) : _radius(radius) {} ;
|
||||
Circle( double radius ) : _radius(radius) {} ;
|
||||
virtual ~Circle() {} ;
|
||||
|
||||
// Implementation of abstract interface
|
||||
|
@ -18,6 +18,6 @@ public:
|
|||
virtual const char* shapeName() const { return "Circle"; }
|
||||
|
||||
private:
|
||||
int _radius ;
|
||||
double _radius ;
|
||||
} ;
|
||||
#endif
|
||||
|
|
Reference in a new issue