In private inheritance derived class members can access base class members that are 1) Public 2) Private 3) Protected A) 1 & 2 B) 1 & 3 C) 2 & 3 D) 1,2 & 3

Showing Answers 1 - 25 of 25 Answers

sheshu

  • Nov 3rd, 2006
 

ans:-> C

  Was this answer useful?  Yes

sujana

  • Nov 29th, 2006
 

A private member cannot be accessed in derived class , to access in the subclass the member has to be declared protected soo answer is public n protected ANS [B]

Md Hedaitullah

  • Mar 9th, 2007
 

Derived class can access only Pubic and Protected members of the base class.

  Was this answer useful?  Yes

vasu

  • May 5th, 2007
 

private members are not inherited.

To use the base class variables in derived classes we must inherit these variables in protected or private mode.

  Was this answer useful?  Yes

lakshmienator

  • Aug 20th, 2007
 

Ans is C
Both private and protected can access it

  Was this answer useful?  Yes

poomathi

  • Aug 24th, 2007
 

private class cannot access the derives class.it has access only within the class...so ans is B...

  Was this answer useful?  Yes

Nagu

  • Feb 27th, 2012
 

Ans : B) 1 & 3 because private access member cant access by derived class.


ref: http://publib.boulder.ibm.com/infocenter/comphelp/v8v101/index.jsp?topic=%2Fcom.ibm.xlcpp8a.doc%2Flanguage%2Fref%2Fcplr130.htm

Access control of base class members (C++ only)
When you declare a derived class, an access specifier can precede each base class in the base list of the derived class. This does not alter the access attributes of the individual members of a base class as seen by the base class, but allows the derived class to restrict the access control of the members of a base class.

You can derive classes using any of the three access specifiers:

In a public base class, public and protected members of the base class remain public and protected members of the derived class.
In a protected base class, public and protected members of the base class are protected members of the derived class.

In a private base class, public and protected members of the base class become private members of the derived class.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions