C++ Test Review
Just some scattered notes for test review. Object Composition Object memory is stored contiguously. If an object has pointers, those pointers are still stored contiguously but point to wherever the data is. Object Ownership One simple approach is to say that whatever creates the object becomes the owner of the object Thus, it becomes responsible for deleting it Inheritance Polymorphism Zombie* bob = new Zombie("Bob"); Zombie* sally = new ZombieSoldier("Sally", 100); bob->attack(); // prints "Bob throws a punch" sally->attack(); // prints "Sally throws a punch" // wait... // ...............?! Objects have static binding by default in cpp. For dynamic binding, methods must have the virtual keyword. static binding by default does offer better performance. ...