Finishing Chapter 12
- You should re-read chapter 12.
- constant reference
- Just like we could pass arrays by const pointer.
- We can pass everything else by constant reference.
- void PrintBucket(const BucketT & bucket);
- This is a good thing
- It documents that we will not be changing the parameter.
- It also means we can make function calls faster.
- But it requires us to learn about const member methods.
- const member methods
- Tells the compiler/user/... that the method will not change the class.
- returnType functionName(parameters) const;
- returnType functionName(parameters) const{}
- This is demonstrated in this code
- Class Scope
- Items in a class have scope within the class.
- This is different that local scope for functions.
- By the way, the Person class exhibits Composition
- A person has a bucket
- This is one of several relationships we will explore in 330.
- Since the bucket can exist without a person, we call this a Shared Aggregation
- UML
- The Unified Modeling Language
- This is a way to draw class design.
- We will do a very simple version for now.
- A class is a box, with three portions
- The first shows the name of the class
- The second gives the member data
- The third gives the methods or member functions
- +/-
- name
- parameters
- :
- Return type
- There is a tool to do this
- Shared aggregation is a hollow diamond
- The diamond points at the containing class.
-