Which of the following statements is false? Each class can define a constructor for custom object initialization. A constructor is a special member function that must have the same name as the class. C++ requires a constructor call for every object that’s created. A constructor cannot specify parameters.

Respuesta :

Answer:

a. Each class can define a constructor for custom object initialization : This is True

b. A constructor is a special member function that must have the same name as the class : This is True

c. C++ requires a constructor call for every object that's created : This is True

d.  A constructor cannot specify parameters : This is False

Explanation

a.  The name of its string instance variable is initialized to null by default, when an object of class account is created, .

b. Constructors often have the same name as the class been declared. They have the duty of initializing the object's data members and also of establishing the invariant of the class.

c. C++ absolutely generates a default copy constructor which  calls the copy constructors for  all member variables and all base classes, except the programmer provides one, directly deletes the copy constructor (in order to avoid cloning) or one of the base classes or member variables copy constructor is deleted or not accessible (private).

d. When an object is created, each class declared  optionally provides a constructor with parameters which would be used to initialize an object of a class. Thus, in order for fields to be initialized in the object at the time of creation, constructors need to specify parameters.

Therefore, the last statement is false

The statement that cannot be considered as true statement in this question is D:A constructor cannot specify parameters.

  • Option is right, because it is very possible for each class to define a constructor for custom object initialization.

  • Option B, is also correct, because there should be the same name for both constructor which is regarded as special member function and the class.

  • Option C is correct, because for every created object, there must be a constructor call for C++ .

Therefore, option D is correct.

Learn more at,:

https://brainly.com/question/14903295?referrer=searchResults