From 6d63474276de8cda4b2d20bb5f37acee1a89569d Mon Sep 17 00:00:00 2001 From: Eric Teunis de Boone Date: Thu, 9 Jul 2020 17:07:15 +0200 Subject: [PATCH] Ex8.* feedback: syntactic sugar --- ex8.2/Manager.hh | 2 +- ex8.2/main.cpp | 8 ++++---- ex8.3/Circle.hh | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ex8.2/Manager.hh b/ex8.2/Manager.hh index 6a099dc..c577561 100644 --- a/ex8.2/Manager.hh +++ b/ex8.2/Manager.hh @@ -36,7 +36,7 @@ public: private: string _name ; double _salary ; - set _subordinates ;// subordinates is an unordered collection so set is usefull enough + set _subordinates ;// subordinates is an unordered collection of unique people so set is usefull enough } ; diff --git a/ex8.2/main.cpp b/ex8.2/main.cpp index 5f32235..96efd77 100644 --- a/ex8.2/main.cpp +++ b/ex8.2/main.cpp @@ -10,15 +10,15 @@ void populate_directory( set& 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 ); diff --git a/ex8.3/Circle.hh b/ex8.3/Circle.hh index 00a50b9..bcceb88 100644 --- a/ex8.3/Circle.hh +++ b/ex8.3/Circle.hh @@ -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