Classes: Variables& Functions

Started by
11 comments, last by Prozak 22 years, 4 months ago
yes, just use conversion operators. They are sort of the opposite of constructors.
Advertisement
ok, so i''ve just started relearning c++, but i think you people are reading into this too much.
can''t you just make an accessor function, and put the other stuff in there?
  class Feh  {  private:    bool p_doorclosed;  public:    bool getDoorClosed(void) {return p_doorclosed;};    void setDoorClosed(bool IsClosed)      {      p_doorclosed = IsClosed;      if (p_doorclosed) DoOtherStuff();      };  };  

that''d do it, no?
without making new classes or overloading operators?

--- krez (krezisback@aol.com)
--- krez ([email="krez_AT_optonline_DOT_net"]krez_AT_optonline_DOT_net[/email])
yeah you can do that, we just want something a little nicer.

This topic is closed to new replies.

Advertisement