Member function

This is a discussion on Member function within the C++ Programming forums, part of the General Programming Boards category; Can anyone explian to me why is there member function in c++?Is it because it would be easier to call ...

  1. #1
    Registered User
    Join Date
    Jan 2012
    Posts
    19

    Post Member function

    Can anyone explian to me why is there member function in c++?Is it because it would be easier to call functions for variables of the same type?

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    20,955
    Just considering a class that is neither a derived class nor intended to be a base class: member functions in C++ are intended to access the implementation detail of the class, which generally means the private member variables of the class. This way, if the private member variables change, only the member functions need to be updated, at least in theory.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Passing member variable as default arg to member function
    By Memloop in forum C++ Programming
    Replies: 1
    Last Post: 09-08-2009, 06:49 PM
  2. Replies: 3
    Last Post: 07-23-2006, 01:09 PM
  3. member member function pointers
    By Bigbio2002 in forum C++ Programming
    Replies: 3
    Last Post: 12-04-2005, 04:14 PM
  4. Function Pointers to a Member, from a Member
    By littleweseth in forum C++ Programming
    Replies: 4
    Last Post: 11-01-2003, 01:12 AM
  5. private data member with public set member function
    By Mario in forum C++ Programming
    Replies: 2
    Last Post: 05-28-2002, 10:53 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21