Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started