========================================================================== Section 10 Notes ========================================================================== - 1. Manipulating an Array of IObjects - 2. Creating a new IObject - We will be trying out Coding Ground, this url has code to start with + http://tpcg.io/U0EmkN -------------------------------------------------------------------------- 1. Manipulating an Array of IObjects -------------------------------------------------------------------------- - implement the print function + takes as input an array of IObject pointers and a size + prints out each IObject - modify main to test this out + create an array of a few IObjects in main + initialize each item in array to an Integer + call print - implement the destruct function + takes as input an array of IObject pointers and a size + deletes each IObject - modify main to call destruct to avoid memory leak - implement the contains function + takes as input an array of IObject pointers and a size + also takes a const reference to an IObject to search for + returns true if IObject is found, else return false - modify main to test this out + call contains on the array of IObjects you previously created + test when contains return true, and when returns false -------------------------------------------------------------------------- 2. Creating a new IObject -------------------------------------------------------------------------- - ShortString is a simple class that can hold a short string + string can only be 4 characters _including_ null terminator + string is stored in the object not on the heap - uncomment the sketch of the ShortString class + implement the default constructor + implement the constructor from C string + implement the copy constructor + implement the destructor + implement the clone function + implement the to_str() function + return zero for len for now + return false for eq for now - modify main to test this out + create an array of a few IObjects in main + initialize each item in main to a ShortString + call print - modify main to demonstrate dynamic polymorphism + create an array of a few IObjects in main + initialize some items in array to an Integer + initialize some items in array to a ShortString + call print - finish ShortString implementation + implement len + implement eq - modify main to demonstrate dynamic polymorphism + create an array of a few IObjects in main + initialize some items in array to an Integer + initialize some items in array to a ShortString + call print and contains on this array