04-29-2011, 08:17 AM
What are constant members functions
|
What are constant members functions in c++ 2011
|
|
04-29-2011, 08:17 AM
What are constant members functions
04-29-2011, 08:18 AM
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; } }; 0300-9520262 Get solution in 24 hour |cpmputer & internet mileys81:[SIZE="4"][SIZE="3"]....[/SIZE][/SIZE]
|
|
« Next Oldest | Next Newest »
|