To prevent class objects from being copied or assigned, you can:
1. Declare as private the class's copy constructor and overloaded assignment operator.
2. Declare the class's copy constructor and overloaded assignment operator with with = delete after the parameter list.
3. Simply do not declare a copy constructor or assignment operator in the class.
4. Declare as private the class's copy constructor and overloaded assignment operator or declare the class's copy constructor and overloaded assignment operator with with = delete after the parameter list.

Respuesta :

Limosa

Answer:

The correct answer to the following question is option 4.

Explanation:

The private class does not mean that the package-private, it means that no other class can see its members.  

It is used in creating the building blocks which is implementing the internal functionality that you don't want to visible to the other projects using the library.

We can use private constructor to ensure that more than one object cannot be created at the time.

ACCESS MORE
EDU ACCESS
Universidad de Mexico