EECS 280 Lecture 6: EECS 280 Lecture 6 – Compound Objects
Document Summary
Const: we tell the complier we never intend to modify it keeps us honest, a type qualifier forbids assignment initialization: ok (first value) Const in declaration: as always, read from inside out. Arr is an array of 6 pointer to const ints: what can be const. Const vs. pointer to const: const. The pointer value (an address) itself cannot change: pointer to const. You (cid:272)an"t use the pointer to (cid:272)hange the o(cid:271)je(cid:272)t. Const conversions: we can convert a const value into a regular value (just making a copy, we cannot convert a pointer to const to a regular pointer. Kinds of objects in c+: atomic. Pointer types int, double, char, etc: arrays. A contiguous sequence of objects of the same type: compound. Compound object made up of member subobjects. The members and their types are defined by a struct or class. Compound objects: we can use both struct and class to create compound objects in c++