Sabtu, 11 Maret 2017

What are Constant Objects in Programming

When there is a need to create a read-only object, the object can be declared as a constant object using the const keyword. Syntax for creating a constant object is as follows:   ClassName const object_name(params-list);   Following are the characteristics of a constant object: Constant object can be initialized only through a constructor. Data members of a constant object cannot be modified by any member function. Constant object are read-only objects. Constant objects should be accessed only through constant member functions.   Following program demonstrates a constant object: 1 2 3 4 5 6 7 8 9 10 11

The post What are Constant Objects in Programming appeared first on Coding Security.


What are Constant Objects in Programming
read more

Tidak ada komentar:

Posting Komentar