Start New Discussion within our Software Development Community

Hey I know this is really simple, I'm studying my first course of C++. In my prac for the week it asks:

"A TrainCar is a base class representing carriages for a train. It defines no attributes but has a public function called shape which accepts no arguments and returns a string object. The shape a TrainCar shape function returns an empty string."

Within this base class object. I understand that there is one function called shape which accepts no arguments and returns a string object. What I dont understand is "has no attributes"? Does that mean that they're are no variables allowed in the program?

ie

class trainCar
{
   public: 
      void print();      // I understand this
   private:
      string shape;    // is this what my lecture means by not defining attibutes? according
                            //  to the requirments of the program can I use this prive variable or
                            // is this what a attribute is?
};

I think your lecturer meant following:

class TrainCar
{
public:
  virtual string shape(){ return ""; }
};
This question has already been answered. Start a new discussion instead.