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

1. What on earth is an object in C++? 2. Why Accessors and Mutators required? 3.

ID: 3823688 • Letter: 1

Question

1.      What on earth is an object in C++?

2.      Why Accessors and Mutators required?

3.      What is the difference between a pointer to a duck and a duck?

4.      What would be found inside of a pointer? How about inside a pointer to a pointer? How about a pointer to a pointer to a pointer?

5.      How many lines does it take to make an object linkable? What are they?

6.      Why would anyone use a link list when they could just use an array?

7.      Give an example of an instance of class definition being used INSIDE another class definition. You can be abstract or some easy real world example. You need not write any code for this question.

8.      “Is-A” and “Has-A” are common vernacular for what kind of relationships between objects?

9.      How many of the following are allowed in a C++ class definition?

a)      Constructors

b)      Destructors

c)      Accessors for a particular piece of Data?

10.   When do we use “PROTECTED” data status? How is it related to “PRIVATE” and “PUBLIC”?

Explanation / Answer

1.      What on earth is an object in C++?

A) An Object is a basic unit of Object Oriented Programming Languages like C++. Generally class gives the data and the operational form to the object i.e. we initiate the object with the class only. Objects will normally have state and behaviour. If we want to take some real world examples of Object anythinh as such containing state and behaviour is called an object. For ex car is an object which has different state (current gear,speed etc) and behaviour (changing gears, applying breaks etc). Like this you may assume for everything you may come across. The things which is having state and behaviour is called an object.

2.      Why Accessors and Mutators required?

A) Accessors and Mutators are nothing but getter and setter methods. Data encapsulation will be possible with using accesors and mutator methods. These accessor method is used to retrieve the value of the private data members.and mutator methods are used to set the values of the private data members. word get is used before the method name for Accessor and the word set is used before the method name for mutator.

3.      What is the difference between a pointer to a duck and a duck?

A) Generally pointer is a variable which stores the address of another variable. Here the pointer to a duck will have the address of the duck. And the duck will be havind the main content/value in it.

4.      What would be found inside of a pointer? How about inside a pointer to a pointer? How about a pointer to a pointer to a pointer?

A) The inside of pointer contains the address of another variable which it is referring. If there is pointer inside a pointer which means the first pointer stores the address of the second pointer and the second pointer will have the address of the original value/actual value. Basically pointer to pointer is like chain of pointers. The pointer to pointer to pointer will also be having same like one pointer will have address of another, then it will have the address of another and this one will have actual value. But this is not at all good practice to use as such