You get a bonus - 1 coin for daily activity. Now you have 1 coin

1.4. Components-data and components-functions1.4.1. Data - class members

Lecture



1.4.1. Data - class members

The definition of a class data is externally similar to the description of variables of basic or derived types. However, when describing the class data, their initialization is not allowed. To initialize them, an automatic or explicitly called constructor should be used. Functions belonging to a class have full access to its data. To access data elements from operators performed outside the class definition, one must use the operations of selecting the components of a class (“.” Or ”->”). Class data need not be defined or described prior to their first use in class-related functions. All components of a class are “visible” in all operators of its body. The area of ​​access to the data components is regulated by the access modifier (see section 1.2). The data components can be described as const . In this case, after initialization, they cannot be changed. Data components can be described as mutuable . In this case, they are mutable, even if the object containing them is described as const.

Comments


To leave a comment
If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

C ++ (C plus plus)

Terms: C ++ (C plus plus)