Question: Question 6 (a) What is the difference between a class and an object in object oriented pro gramming? [3 marks] (b) Objects model state and

Question 6 (a) What is the difference between a class and an object in object oriented pro gramming? [3 marks] (b) Objects model state and exhibit behaviour. Explain how state and behaviour are implemented in C+ + [2 marks] (c) What is the role of a class destructor? How is it written in C++? Give an example of what you might do in a destructor. (d) When is it necessary to define a default constructor? (e) What is the purpose of static class variables? (f) Briefly describe the use of encapsulation and abstraction in C++ classes? [3 marks] [2 marks] [2 marks] [3 marks] (g) Complete the following table on C++ class access control, using Y if the ac- cess is allowed and 'N' if it is not.The public access control has been done for you (public variables and methods are available within the class, within subclasses and also outside of the class, within class within subclass outside of class public private protected [3 marks]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
