Sponsored Links


Results 1 to 2 of 2

Thread: What are constant members functions in c++ 2011

  1. #1

  2. #2
    Administrator Vuhelper's Avatar
    Join Date
    Apr 2011
    Posts
    9,578
    Constant member functions are those functions that can not modified the object state. Constant member functions are “read only”. Constant data member function can not change data member. To declare a constant member function, place the const keyword after the closing parenthesis of the argument list. The const keyword is required in both the declaration and the definition.
    Syntax:
    class className{
    returnValue Function() const;
    };
    Definition:
    returnValue className:: function() const{
    }
    Example:
    class Student{
    public:
    int getRollNo() const {
    return rollNo;
    }
    };

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 3
    Last Post: 04-12-2012, 04:53 PM
  2. what does the term Constant time mean in c++ 2012?
    By Vuhelper in forum C++ Programing
    Replies: 0
    Last Post: 01-04-2012, 10:14 PM
  3. Replies: 1
    Last Post: 05-02-2011, 04:57 PM
  4. Replies: 1
    Last Post: 05-02-2011, 06:31 AM
  5. Eid mubarak to all members, 2011
    By Xpert in forum Announcements
    Replies: 0
    Last Post: 11-18-2010, 04:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
-: Vuhelp Disclaimer :-
None of the files shown here are hosted or transmitted by this server. The links are provided solely by this site's users. The administrator's or staff of Vuhelp.net cannot be held responsible for what its users post, or any other actions of its users. You may not use this site to distribute or download any material when you do not have the legal rights to do so. It is your own responsibility to adhere to these terms. If you have any doubts about legality of content or you have any suspicions, feel free to contact us.
Online Education | JhelumSoft | Jobs