1.

Which syntax for class definition is wrong?(a) class student{ };(b) student class{ };(c) class student{ public: student(int a){ } };(d) class student{ student(int a){} };I had been asked this question in exam.Question is from Classes topic in section OOPs Concept & Features of Object Oriented Programming

Answer»

Right choice is (b) student class{ };

The best explanation: KEYWORD class should COME first. Class NAME should come after keyword class. PARAMETERIZED constructor definition depends on programmer so it can be left EMPTY also.



Discussion

No Comment Found

Related InterviewSolutions