Which among the following is wrong?

Lê Minh

Member
Which among the following is wrong?
A. class student{ }; student s;
B. abstract class student{ }; student s;
C. abstract class student{ }s[50000000];
D. abstract class student{ }; class toppers: public student{ }; topper t;
 
Answer: b
Explanation: We can never create instance of an abstract class. Abstract classes doesn’t have constructors and hence when an instance is created there is no facility to initialize its members. Option d is correct because topper class is inheriting the base abstract class student, and hence topper class object can be created easily.
 

Tìm kiếm

Back
Top