Discussion
Which of the following is true about constructors in C++ ?
Answer: B
The true statement is A constructor has the same name as the class.
A C++ constructor is a member function with the same name as its class, called automatically when an object is created, to initialise it.
Constructors have no return type and cannot return values. They need not have parameters (a default constructor has none). A constructor is normally called automatically when an object is created; whatever one makes of explicit calls such as ClassName(args), the defining property the key asks for is the shared name.
No comment is present. Be the first to comment.
Loading…
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development