member function

This is a discussion on member function within the C++ Programming forums, part of the General Programming Boards category; What does it mean to have void as the parameter for the prototype of a member function ie void set(void);...

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    52

    member function

    What does it mean to have void as the parameter for the prototype of a member function ie

    void set(void);

  2. #2
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,136
    It doesn't return a value.

    Code:
    class foo
    {
         int abc;
    
       public:
          void set(){abc=5;};//sets abc to five
    }

  3. #3
    Registered User
    Join Date
    Jan 2002
    Posts
    52

    thanks

    thanks
    I noticed you didn't use the keyword private in your class declaration. Is this the default then?

  4. #4
    Registered User xlnk's Avatar
    Join Date
    Mar 2002
    Posts
    186
    in a class everything defaults to private, unless otherwise noted.
    the best things in life are simple.

  5. #5
    Registered User VBprogrammer's Avatar
    Join Date
    Mar 2002
    Posts
    175
    It is good practice to start a class with a private/public keyword, dont know why, just is..
    VC++ 6

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 04-19-2008, 12:06 AM
  2. Replies: 28
    Last Post: 07-16-2006, 11:35 PM
  3. Calling a Thread with a Function Pointer.
    By ScrollMaster in forum Windows Programming
    Replies: 6
    Last Post: 06-10-2006, 08:56 AM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  5. c++ linking problem for x11
    By kron in forum Linux Programming
    Replies: 1
    Last Post: 11-19-2004, 09:18 AM

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