C++ Programming Assignment
Background Encapsulation and inheritance are two main concepts of object oriented programming, which are tested in this assessment. Encapsulation allows The bundling of data and functions together Access restrictions to certain components as defined by the programmer (you!) Therefore when you write a class, you place data variables (like double, int, string) at the same place as you would place functions (including the constructor too – as constructors are special types of functions that are called when an object of the class is created). Also you define public: protected: and private: “areas”, all of which have different access restrictions. Public members can be accessed from main(), which is interpreted or seen as the “outside world”. Private members can only be accessed by the class itself, i.e., only the functions of that class may access the members. Codes from main() cannot access private members of a class. Protected members may only be accessed by the class itself, and also its child classes (through inheritance). Noone else in main() can access them. Inheritance is demonstrated through several related classes. The parent class is a more GENERAL version of a child class. This means, the child class is a more SPECIFIC version of the parent class. Always check the validity of a child class by using the “… is a …” test. Instructions You are assessed on understanding of encapsulation in the design of your classes; understanding of inheritance; writing useful comments You have to write a main.cpp, appropriate .h (header files) and .cpp (source files), rather than writing all classes in the same file as main.cpp. You are required to upload multiple files to Moodle. I will demonstrate how to upload those files during the lab (22/11/12 9am-11am). Tasks Write the following five classes: Animal, Dog, Cat, PetDog, StrayDog. These are the properties of the above classes: They all have a name and an age each. They all can speak: the Dog barks...