Lab 4 Prelab Questions 1. Describe how a class and a struct differ? 2. Describe the differences between public and private in reference to classes. 3. Describe what a constructor is and how is it used? Give an example of a constructor being used. 4. Describe what a destructor is and how is it used? Give an example of a destructor being used. 5. Create a class called dog with private data members of a name and age. The constructor should give a blank name, and an age of 0. Create the following public functions: get an age, age the dog by one year, get the name, and set the name. 6. Describe what is wrong with the following code: class rectangle { int length; int breadth; public: int area() { return length * breadth; } }; int main() { rectangle rect; rect.length = 5; rect.breadth = 4; int rect_area = rect.area(); } 7. How would you fix the errors in example 6 (Hint: Think of accessor and mutator functions) 8. Will the following code compile? If yes why? If not, how will you fix it? class vehicle { public: void start(); void stop(); private: int speed; int doors; vehicle(int s, int d) { speed = s; doors = d; } }; 9. Write a class to represent a car, similar to above class. Write a constructor for this class, which will set the number of doors to 2 and speed to 0. Now create a instance of this class in the main function. 10. Consider the following code: class book { int pages; public: void book(int p) { pages = p; } }; Describe what is wrong with the above code? Write the code that would fix the above code.