What is the difference between public, private, protected
inheritance?




Answers were Sorted based on User's Feedback



What is the difference between public, private, protected inheritance?..

Answer / dee

public-->inherite the protected members as preotected in
drived class and pubic members wiull be public in derived
class

protected--->pubic and protecated members of the base class
will become protected in derived class

Private-->pubilc and proteacted members will become private
in derived class

Is This Answer Correct ?    170 Yes 48 No

What is the difference between public, private, protected inheritance?..

Answer / priya

public: class members are access from the outside the class
private: class members can access only within the class
protected:class members can access inside the same package

Is This Answer Correct ?    104 Yes 51 No

What is the difference between public, private, protected inheritance?..

Answer / munish saini

** Public variables, are variables that are visible to all
classes.

** Private variables, are variables that are visible only
to the class to which they belong.

** Protected variables, are variables that are visible only
to the class to which they belong, and any subclasses.

Is This Answer Correct ?    41 Yes 10 No




What is the difference between public, private, protected inheritance?..

Answer / vivek kumar kaushal

Public: this is member function of its own and anyother
class.
Private: Class member access within its class.
Protected:this is member function to its own and derived
class.

Is This Answer Correct ?    34 Yes 5 No

What is the difference between public, private, protected inheritance?..

Answer / girish kumar

publc: variable declare in public can be access anywhere in the program i.e. other classes can also use same variable which are declare once.
private:variable declare in private can't be access outside the class in which it is declare .Variable are only access in the same class.

Is This Answer Correct ?    24 Yes 3 No

What is the difference between public, private, protected inheritance?..

Answer / tekle

The type or member can be accessed by any other code in the
same assembly or another assembly that references it.

private

The type or member can only be accessed by code in the same
class or struct.

protected

The type or member can only be accessed by code in the same
class or struct, or in a derived class.

Is This Answer Correct ?    18 Yes 4 No

What is the difference between public, private, protected inheritance?..

Answer / saikat

A private member can only be accessed by other methods of
the same class, while a public member can be accessed by
methods of any class or by non class code.

Is This Answer Correct ?    9 Yes 9 No

What is the difference between public, private, protected inheritance?..

Answer / krishnakumar

Modifier | Class | Package | Subclass | World

public | Y | Y | Y | Y

protected | Y | Y | Y | N

no modifier | Y | Y | N | N

private | Y | N | N | N

Is This Answer Correct ?    3 Yes 4 No

What is the difference between public, private, protected inheritance?..

Answer / sehrish

in private inheritance the private public and protected membrs are inaccessible

Is This Answer Correct ?    0 Yes 2 No

What is the difference between public, private, protected inheritance?..

Answer / sasikumar

everything which is aware of base is also that base
contions public member,,,

Is This Answer Correct ?    12 Yes 18 No

Post New Answer



More C++ General Interview Questions

how can u create a doubly linked list with out using pointers?

2 Answers  


What is size of Empty Class?

3 Answers   Persistent,


What is design pattern?

2 Answers   Samsung,


There is a magic square matrix in such a way that sum of a column or a row are same like 3 5 2 4 3 3 3 2 5 sum of each column and row is 10. you have to check that matrix is magic matrix or not?

1 Answers   TCS,


How do you print for example the integers 3,2,1,5,4 in a binary tree within the console in format where it looks like an actual binary tree?

0 Answers  






Explain working of printf?

8 Answers  


make a middle node of doubly linklist to the top of the list

1 Answers  


What is size of a object of following class? class Foo { public: void foo(){} }

2 Answers   CA,


What is Object Oriented programming.what is the difference between C++ and C?

8 Answers   Infosys,


What are the popular tools used to detect memory leaks in c++

4 Answers   TATA,


in C++ , the word plus plus who found this?

4 Answers  


structure that describe a hotel with name, address,rooms and number of rooms

2 Answers  






Categories