C++ Programming - Objects and Classes - Discussion

Discussion Forum : Objects and Classes - General Questions (Q.No. 19)
19.
Which of the following statements is correct?
Data items in a class must be private.
Both data and functions can be either private or public.
Member functions of a class must be private.
Constructor of a class cannot be private.
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
12 comments Page 2 of 2.

Suphoebe said:   5 years ago
A constructor can be Private. For example: singleton mechanism.

Soumya G said:   2 years ago
A constructor can be private and we can create an object for that class using the friend class.


Post your comments here:

Your comments will be displayed after verification.