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 encapsulation selenium?

0 Answers  


WHY FUCTION OVERLOADING DOSENOT RETURN A RETEN TYPE

2 Answers  


C#.net Interview Question A=10 B=5 C=A+B Print C The above will be given in a multiline textbox. You need to parse the above input, store values for A,B&c. And you have to display the value of C.

1 Answers   Syncfusion,


what is the difference between javap and jad utility

1 Answers   Wipro,


1.what are two type of classe members called? 2.what is data hiding and data encapsulation? 3.how do you make a class member visible aouside its class? 4.what is the default visibility of a class data member? 5.what are the advantages of oop over the structured programing?

6 Answers  






What is namespace?

15 Answers  


What Is a Polymorphism? How many types of polymorphism and whats that use in application?

2 Answers  


What is Difeerence between List obj=new ArrayList(); and ArrayList obj=new ArrayList()?

0 Answers   NIIT, SRA,


create a c++ program that will ask 10 numbers and display their sum using array.

1 Answers  


What are the 3 pillars of oop?

0 Answers  


What is oops with example?

0 Answers  


What is the difference between declaration and definition?

20 Answers   IBS,


Categories