adplus-dvertising
frame-decoration

Question

Which among the following is correct for the code given.
class A
{
    private: int marks;
    A()
    { 
    }
    Public : disp()
    { 
          cout<< marks; 
     }
};
class B: public A
{
}
B b;

a.

Instance of B will not be created

b.

Instance of B will be created

c.

Program gives compile time error

d.

Program gives runtime error

Answer: (a).Instance of B will not be created

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. Which among the following is correct for the code given.

Similar Questions

Discover Related MCQs

Q. If protected inheritance is used then _____

Q. If protected members are to be accessed from outside the class then__________

Q. Which among the following can use protected access specifier?

Q. Protected access is same as default access that is given implicitly in java if no specifier is mentioned.

Q. If a class have default constructor defined in private access, and one parameter constructor in protected mode, how will it be possible to create instance of object?

Q. If the members have to be accessed from anywhere in program and other packages also, which access specifier should be used?

Q. Which among the following have least security according to the access permissions allowed?

Q. Which among the following can be used for outermost class access specifier in java?

Q. We can reduce the visibility of inherited methods.

Q. If members of a super class are public, then________

Q. How many public class(s) (outermost) can be there in a java program?

Q. Which among the following for public specifier is false?

Q. A class has its default constructor defined as public. Class B inherits class A privately. The class:

Q. Which specifier can be used to inherit protected members as protected in subclass but public as public in subclass?

Q. Which among the following is true for public class?

Q. If a class doesn’t have public members, then________

Q. In multi-level inheritance(all public) , the public members of parent/superclass will ________

Q. Which specifier allows to secure the public members of base class in inherited classes?