CMPSC 32 Lecture 6: Lecture 6
Document Summary
Containment relation that can be represented by indented lists, balanced parentheses/braces, subsets, trees. Compiler needs to know which class (scope) you mean when writing methods. Scope resolution operator tells which class a method is coming from. Scope resolution operator is used after a class name. Linker = called by the compiler to stitch all things together into the final program. Object-based programming = using classes just for encapsulation. Use structs only for objects with public variables and no methods. But you should explicitly state if it"s private or public. Constrain how the state of the program is changed. Whole program (except for garbage collector) is a mutator. For plain objects, assignment means plain member copying. Implicit default constructor has same effect as user-defined constructor with empty body and empty initializer list. Invoked when a pre-existing object (not a pointer) is assigned to another pre-existing one. When class members hold memory, copying gets trickier.