Senin, 06 Februari 2017

What are constant member functions and constant parameters

Member functions in a class can be declared as constant if that member function has no necessity of modifying any data members. A member function can be declared as constant as follows: 1 2 3 4 return–type function–name(params–list) const { //body of function }   Following program demonstrates the use of constant member functions: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 #include<iostream> using namespace std; class Circle { private:

The post What are constant member functions and constant parameters appeared first on Coding Security.


What are constant member functions and constant parameters
read more

Tidak ada komentar:

Posting Komentar