Thread: Superficial Syntax thread: Your favorite keywords/class names etc.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    In C++, and following the creator own terminology, member functions and member variables are the usual terminology used to describe functions and variables of a class. I understand this is not the same on all languages. If I recall correctly Java users use method and properties.

    I don't see a problem with any way, albeit I prefer to use the term that is more spread in whatever language I'm working on in order to make myself better understood.

    It's been always my thought that Method and Property usage seem to focus more on the object instance since this is where those nouns make more sense, I think. Whereas member function and member variable make more sense when describing a class... particularly in C++ where the terms pointer to method or friend method don't make much sense at all.

    Getter and Setter on the other hand are mostly VB, and as far as I know also used as a terminology in C#. They don't seem to be that spread around C++ programmers. I prefer the collective term accessor functions but find myself using getter and setter when not thinking about it. This is so mostly, I think, because I always prefix them with get and set.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  2. #2
    HelpingYouHelpUsHelpUsAll
    Join Date
    Dec 2007
    Location
    In your nightmares
    Posts
    223
    Quote Originally Posted by Mario F. View Post
    It's been always my thought that Method and Property usage seem to focus more on the object instance since this is where those nouns make more sense, I think. Whereas member function and member variable make more sense when describing a class... particularly in C++ where the terms pointer to method or friend method don't make much sense at all.
    I heard in a python lecture that a method is a function that operates on an object and a function takes an object or a series of objects. E.g. (I will make up an example):
    Code:
    :WNDCLASS.hCursor.LoadCursor(NULL, IDC_ARROW); //method, if this existed
    DialogBox(hinst, MAKEINTRESOURCE(DLG_0100), NULL, (DLGPROC) DialogFunc); //Function
    string.split(' ') random python example of a method (not C)
    There are probably better examples of methods in C++, but I haven't learnt it yet. Helps distinguish the difference though. As for a property, this is an example:
    Code:
    WNDCLASS.lpszClassName
    long time no C; //seige
    You miss 100% of the people you don't C;
    Code:
    if (language != LANG_C && language != LANG_CPP)
        drown(language);

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. PlaySound
    By cangel in forum C++ Programming
    Replies: 16
    Last Post: 10-08-2009, 05:29 PM
  2. Simple thread object model (my first post)
    By Codeplug in forum Windows Programming
    Replies: 4
    Last Post: 12-12-2004, 11:34 PM
  3. Replies: 2
    Last Post: 04-12-2004, 01:37 AM
  4. Closing thread handles from within
    By Sang-drax in forum Windows Programming
    Replies: 6
    Last Post: 09-26-2003, 12:18 PM
  5. How to make a thread sleep or std::recv timeout?
    By BrianK in forum Linux Programming
    Replies: 3
    Last Post: 02-26-2003, 10:27 PM