C++
Programming and Technical
Programming
Program
Which constructor is invalid for class cat?
Options
1) void cat :: cat() { feet=4;}
2) cat::cat(int f){feet=f;}
3) cat::cat(void){feet=8;}
4) cat::cat(int f){this->feet=f;}
Read Solution (Total 4)
-
- void cat::cat(void ){feet=8;}
since constructor does not have return type so first one is the answer
- 9 years agoHelpfull: Yes(1) No(0)
- Option 1
There is return type for constructor - 8 years agoHelpfull: Yes(0) No(0)
- 1, return type of constructor is nothing not even void
- 8 years agoHelpfull: Yes(0) No(0)
- Option [1] since a constructor for a class can have no return type, not even "void". Hence the constructor function definition is not valid.
- 5 years agoHelpfull: Yes(0) No(0)
C++ Other Question