From ProgrammingExamples
Jump to: navigation, search

both ctors in the subclasses Pilot and BlimpPilot set the Person's member variable m_Name

   Pilot(std::string &name) : Person(name) {m_Name = name;}
   BlimpPilot(std::string &name) : Pilot(name) {m_Name = name;}

this is not needed and already done by the Person ctor :

   Person(std::string name)
     m_Name = name;

thus, to avoid unneeded (and error prone) work , the ctors should be

   Person(std::string name){m_Name = name;}        // does the affectation of m_Name
   Pilot(std::string &name) : Person(name) {}      // calls 'Person' ctor
   BlimpPilot(std::string &name) : Pilot(name) {}  // calls Pilot' ctor

Cool - I'm out of town for a couple of weeks. Feel free to change. I've marked it in my "follow ups" for when I get back if you don't get to it. Thanks again for your interest and help with starting up this project! Daviddoria 06:09, 4 July 2010 (UTC)