Thread: homework help wanted - Class member functions

  1. #16
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    United States
    Why indeed.

    As long as you understand what mutators and accessors are, I think you understand where they apply. They are not complicated things and their applications are very limited. In fact, it is quite rare. Unless someone comes along and tries to expand the definition of what accessors and mutators are.... Point is, you will not be writing them often.

    It's just something that you learn early on because it is easy.

    Rather than printing like cout << object; you first learn cout << object.getX(); Rather than doing input like cin >> object; you first learn to do cin >> foo; object.setX(foo);

    Graduate from that stage and soon you are solving the same problems only differently.

  2. #17
    Join Date
    Oct 2007
    Inside my computer
    I would still rename the CalculateX to GetX since that's what they do. They return X. How they do that is irrelevant to the one who uses the class. At least, it is at your experience level anyhow.
    You may choose to later rework those functions to return precalculated area and circumference, after all, and then it makes sense that they are called GetX.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  2. Replies: 6
    Last Post: 04-27-2006, 10:55 AM
  3. Problem with Visual C++ Object-Oriented Programming Book.
    By GameGenie in forum C++ Programming
    Replies: 9
    Last Post: 08-29-2005, 11:21 PM
  4. DLL class member functions
    By nickname_changed in forum C++ Programming
    Replies: 1
    Last Post: 07-11-2003, 06:59 AM
  5. gcc problem
    By bjdea1 in forum Linux Programming
    Replies: 13
    Last Post: 04-29-2002, 06:51 PM