What are the restrictions apply to constructors and destructors?



What are the restrictions apply to constructors and destructors?..

Answer / Ram Prakash Pandey

Constructors cannot be declared static, virtual, or inline. They cannot return a value (except for the conversion constructor). Constructors cannot be overloaded on the basis of return type, but they can be overloaded based on parameters. Destructors must have the same name as the class and should not have any parameters or return a value.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C++ General Interview Questions

What is the purpose of ios::basefield in the following statement?

1 Answers  


Do you know the problem with overriding functions?

1 Answers  


int age=35; if(age>80) {Console.WriteLine("Boy you are old");} else {Console.WrieLine("That is a good age");}

1 Answers  


Explain how overloading takes place in c++?

1 Answers  


string somestring ; Which of the following choices will convert a standard C++ string object "somestring" to a C string? a) Copy.somestring () ; b) somestring.c_str () c) &somestring [1] d) std::cstring (somestring) e) (char *) somestring

1 Answers   Quark,


The "virtual" specifier in a member function enables which one of the following? a) Monmorphism b) Late binding c) Metamorphism d) Solomorphism e) Inheritance

4 Answers   Quark,


What is vector pair in c++?

1 Answers  


What problem does the namespace feature solve?

1 Answers  


We use library functions in the program, in what form they are provided to the program?

1 Answers  


Is c++ a dying language?

1 Answers  


Who discovered c++?

1 Answers  


What is std namespace in c++?

1 Answers  


Categories