PDU3701 Assignment 2 Due 23 May 2024
What is the purpose of the keywords public and private in the class declaration? - Correct Answer The public keyword is used to declare a member variable or function that may be directly accessed from outside the class. The private keyword is used to declare a member variable or function that cannot be directly accessed from outside the class. These members can only be accessed/modified with the use of an accessor/mutator function. What is the difference between a class and an object? - Correct Answer A class is a user defined type that defines a collection of properties and methods which can be accessed by creating an instance of that class.
Written for
- Institution
- PDU3701
- Course
- PDU3701
Document information
- Uploaded on
- May 24, 2024
- Number of pages
- 2
- Written in
- 2023/2024
- Type
- Exam (elaborations)
- Contains
- Questions & answers
Subjects
-
what is the purpose of the keywords public and pri
-
what is the difference between a class and an obje
-
what does it mean to instantiate an object
-
what is the purpose of a constructor