Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. A class is an expanded concept of a data structure but it can hold two things

ID: 670357 • Letter: 1

Question

1. A class is an expanded concept of a data structure but it can hold two things which are what?

2. The body of a class declaration serves as the 'prototype' of the class. As such it can contain members, and optional ??????? ??????? for access to those members.

3. An access specifier is one of three keywords:

4. private members of a class are accessible only from _____________ of the same class or from their friends

5. public members are accessible from ________________ where the object is visible

6. A class can include a special function called_____________, which is automatically called whenever a new object of this class is created.

7. The class constructor function must have the same_______ as the class,

8. The class constructor cannot have any return type?

9. Constructors can / cannot (circle correct choice) be called explicitly as if they were regular member functions.

10. Constructors are executed when?

11. A destructor is automatically called when?

12. A destructor is called when an object scope of existence has ___________?

13. or because it is an object dynamically assigned and is released using the operator_________

14. The use of destructors is especially suitable when an object assigns _________ memory during its lifetime and releases that which the object was allocated

15. A constructor can be overloaded with more than one function which has the same name but with what two different things?

Explanation / Answer

1) Class can hold two things one is its state which is depicted by its attributes and second is its behaviour which is defined by its methods.

2) Class can contain members and optional methods for access to those methods.

3) Public, protected and private.

4) Private members of a class are accessible only from the object instances of the same class.

5) Public members are accessible from all places where the object is visible.

6) Constructor.

7) The class constructor function must have the same name as the class,

8) Yes. Constructor doesn’t have return type.

9) Constructors cannot be called explicitly as if they were regular member functions.

10) Constructors are executed when an object of that class is being created.

11) A destructor is automatically called when the variable goes out of scope.

12) A destructor is called when an object scope of existence has lost.

13) or because it is an object dynamically assigned and is released using the operator delete.

14) The use of destructors is especially suitable when an object assigns new memory during its lifetime and releases that which the object was allocated

15) Different number of parameter and different access modifier.