Computer Science, asked by npafho3748, 1 year ago

List some of the special properties of the constructor function

Answers

Answered by Anonymous
6

\huge\mathfrak\green{Hello,}

\huge\underline{Answer:}

Characteristics of constructors ☞

  • They should be declared in the public section.
  • They should be declared in the public section.They are invoked directly when an object is created.
  • They should be declared in the public section.They are invoked directly when an object is created.They don't have return type, not even void and hence can't return any values.
  • They should be declared in the public section.They are invoked directly when an object is created.They don't have return type, not even void and hence can't return any values.They can't be inherited; through a derived class, can call the base class constructor.

Hope\:it\:helps!

Regards,

\huge\mathfrak\purple{Aaravxxx}

Answered by StaceeLichtenstein
2

Special properties of the constructor function is given below

Explanation:

  • Constructors are used to initialize the class.it means that the object is initialised.
  • The name of the constructor should have the same name as the class.it means a constructor's name will have the class name.
  • The constructor never has a type of return. This means that there is no type of constructor return, even void.
  • For example :

#include<iostream> // header file

using namespace std; // namespace

class abc // class abc

{

abc() // constructor

{

cout<< " hello:";

}

};

void main() // main method

{

abc on; // call default constructor

}

Learn More:

brainly.in/question/5798383

Similar questions