What is public, protected, private?

Answers were Sorted based on User's Feedback



What is public, protected, private?..

Answer / khadeer.k

public:
public is an access specifier which can be used throughout
the program.
protected:
protected is an access specifier which can be used in the
specified class and its derived class...
private:
private is an access speifier which can be used whithin the
class in which it is declared.

Is This Answer Correct ?    20 Yes 2 No

What is public, protected, private?..

Answer / yughandhar

public:
public is an access specifier which can be used throughout
the program.
protected:
protected is an access specifier which can be used in the
specified class and its derived class...
private:
private is an access speifier which can be used whithin the
class in which it is declared.

These three access specifiers are used for providing the
security

Is This Answer Correct ?    7 Yes 1 No

What is public, protected, private?..

Answer / prashanth

public,protected,private are access modifiers where public
is used for acess the methods and variables to unlimited
extent.
private:is used to access the variables upto the enclosing
region
protected:and it is limited to class itself or classes that
are derived

Is This Answer Correct ?    5 Yes 0 No

What is public, protected, private?..

Answer / yughandhar

they are acceses specifieres.
these are used for security purpose

Is This Answer Correct ?    4 Yes 2 No

What is public, protected, private?..

Answer / priya

public:public is a access specifier and it is used to access
class member through out the program .
private:private is a access specifier by default our variables are private when we didn't specify any data type for our variable.
protected:protected is a access specifier and its a immediate to derived class.

Is This Answer Correct ?    2 Yes 0 No

What is public, protected, private?..

Answer / reena ashok mohite

Public, Protected And Private these Are the Access Specifier Which We Use In Within The Class,
We Can Use Protected Access specifier In The Class And Its Derived Class,
we Can Use Public Access Specifier throught out the class,
(Anywhere In The Class)
And Private Specifier Can Be Accessable Within The Class Where It Is Declared........
This Is Useful To Data Hiding Purpose

Thanks........

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More OOPS Interview Questions

What is interface? When and where is it used?

0 Answers  


What is data binding?

4 Answers   Ittiam Systems,


What is the Advantage of Interface over the Inheritance in OOPS?

4 Answers  


How do you explain polymorphism?

0 Answers  


what is virtual function?

26 Answers   Aspire, HP, Infosys, RoboSoft, TCS,






What is the purpose of polymorphism?

0 Answers  


What is multiple inheritance ?

17 Answers   Blue Star, C DAC, CDAC, Impetus, Ness Technologies, Softvision Solution,


What is Hashing and how is it done? Pictorial form?

2 Answers   emc2, Wipro,


What is multiple inheritance? Give Example

6 Answers   Mind Tree,


WAP to generate 2n+1 lines of the following pattern on the computer screen:

2 Answers  


How to overload new operator in c++

2 Answers  


//what is wrong with the programme?? #include<iostream.h> template <class first> class dd { first i; public: void set(); void print(); }; void dd< first>:: set() { cin>>i; } void dd< first>::print() { cout<<"\n"<<i; } void main() { dd <char>g; g.set(); g.print(); }

1 Answers  


Categories