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

Question 2 - a bit of theory and terminology (a) What is the purpose of the keyw

ID: 3748956 • Letter: Q

Question

Question 2 - a bit of theory and terminology (a) What is the purpose of the keywords public and private in the class declaration? (b) What is the difference between a class and an object? (c) What does it mean to 'instantiate' an object? (d) What is the purpose of a constructor? (e) What is the difference between the default constructor and the overloaded constructor? (f) What is the purpose of a destructor? (g) What is the purpose of an accessor? (h) What is the purpose of a mutator? (C) What is the purpose of the scope resolution operator? (0) What is the difference between the scope resolution operator and the dot operator? (k) What is the difference between a member function and an ordinary function? () What is an abstract data type (ADT)? (m) How do we create an ADT? (n) What are the advantages of using ADTs? (o) What is separate compilation? (p) What are the advantages of separate compilation? (q) What is a derived class? (r) What is the purpose of inheritance?

Explanation / Answer

to access the variable and function of a class outside the class used public access specifier

by using private access specifier the function and variable cannot be used outside he class.

class: class has function and variable.

and to access the variable and function of class object is used.

class abc

{

public:

int a;

};

void main()

{

abc a;

a.i=10;

}

here abc is a class and a is the object that access the variable of class.

c) Instantiate meaning to create an object or allocating the memory for the object and calling the constructor.

D)constructor has the same name as class have. constructor can be used to initialize variable.

The constructor part is automatically executed whenever the object is created.

E) default constructor if there is there is no constructor in class then by default default constructor is called on the other hand the overloaded constructor has to be created in class. overloaded constructor has the same name but difffernt arguments and datatype.

f) destructor: it has the same name as constructor and it is used to release resources that is allocated to a program .

g) accessor : it is a member function and can be used to access the protected members of a class.

h) mutator: it is a member function and used to edit the protected members.

i) to access the public and protcted data member of a class scope resolution operator is used.

j) to access the emmbers of class by object dot operator is used.

to access the members of class globally scope resoluuion operator is used.

k) an ordinary function is directly in the main function and has zero or one argument and a return type.

a member function is accessed through the object of a class.

l)Abstract data type : it seperate the logical properties from the implementation details.

m)to create ADT define ADT as a class and the definition of class and its member function in a seperate class and class is then compiled. and can be used in other programs.

n)ADT means abstract data type and it hides the details how the operations are implemented.

o)In separate compilation the large program is divided into small program and kept in separate files and compiled and linked together when program runs.

p)Programmer can build a library of classes so that users can use it. and sources files are compiled separately. if the code is alrge in size by seaprately compilation it is easy to understand.

q) derived class: derived class is a specialized class that is created by inheritance its adds the feature of base class.

r) inheritance : by inheritance the existing code can be used. It allows the new class by including the base class features.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote