Answer to Question #210350 in C++ for Ree

Question #210350

(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? (i) What is the purpose of the scope resolution operator? (j) 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? (l) 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? 


1
Expert's answer
2021-06-25T05:21:46-0400
a.       Public and private are used to specify how data members and methods of a class are accessed. Public specifies data members or methods that can be accessed inside and outside the class. Private specifies data members or methods that can only be accessed inside the class.

b.      Class is a template or blueprint from which objects are created while an object is an instance of a class.

c.       It means to create an instance of a class (object).

d.      Purpose of a constructor is to initialize object of a class.

e.       Default constructor is a constructor that contains no argument while overloaded constructors are constructors with the same name but different number of arguments or data types of the arguments.

f.       Purpose of a destructor is to deallocate memory for class object.

g.      Returns the value of data member.

h.      Sets the value of data member.

i.        Are used to get hidden names due to variable scopes in a class.

j.        The scope resolution operator is used to indicate the class name to which an object belongs, whereas the dot operator is used to indicate to which object a member variable belongs.

k.      An ordinary function is nothing but a function with a return type and zero or more arguments. It can be called directly in the main or other functions. A member function is declared or defined within a class or structure. It is generally called with reference to the instance of the class or structure.

l.        Abstract Data type (ADT) is a type (or class) for objects whose behaviour is defined by a set of value and a set of operations.

m.     

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS