Study Notes (09): C ++ Language Basics video tutorial with const -3.9 implementation of protection

Learning immediately: https://edu.csdn.net/course/play/474/5136?utm_source=blogtoedu

Often object definitions:

const class name object name [(argument list)]

Const object class name name [(argument list)]

Often the object must have the initial value

Chang member functions:

Const function name

Regular member functions can access the object's data members but often can not be changed

Often data can only be initialized by a member of the initialization parameter table constructor (and not assigned)

Often only the object type const member functions can be called, in addition to the implicit constructor and destructor functions

If you must modify the data members often object, it can be declared as mutable

 

Published 17 original articles · won praise 0 · Views 131

Guess you like

Origin blog.csdn.net/cangersuifeng/article/details/104857670