GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Tech FAQs  >  OOPS
Go To First  |  Previous Question  |  Next Question 
 OOPS  |  Question 176 of 255    Print  
What do you mean by public, private, protected and friendly?

  
Total Answers and Comments: 1 Last Update: January 24, 2006   
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
January 24, 2006 07:21:09   #1  
samiksc Member Since: October 2005   Contribution: 233    

RE: What do you mean by public, private, protected an...

These are access specifiers for class data members and member methods.

  1. Public:  The data members and methods having public as access specifier can be accessed by the class objects created outside the class.
  2. Protected: The data members and methods declared as protected will be accessible to the class methods and the derived class methods only.
  3. Private: These data members and methods will be accessible from the class methods only, not from derived classes and not from objects created outside the class.
  4. Internal: Some languages define internal as an access specifier which means the data member or method is available to all the classes inside that particular assembly.
  5. Friend: A friend class or method can access all data of a class including private and protected data.

 
Is this answer useful? Yes | No

 Related Questions

Latest Answer : Samik your explanation is nice.Easy for the beginner to understand. ...

Latest Answer : These are access specifiers for class data members and member methods.Public:  The data members and methods having public as access specifier can be accessed by the class objects created outside the class.Protected: The data members and methods declared ...

Latest Answer : A friend function can access all private protected and public data of a class. A class has to declare a function or another class as a friend. Also the friendship is one way. Class A is friend of class B does not mean that class B is friend of class A. ...
Read Answers (1) | Asked by : vasanthakumar
Tags : OOPS

If I am declaring a private member in abstract class, although it will not be accessible in derived classes and can not be accessible by instantiating the abstract class. Then what is the optimal use of declaring private member in an abstract class.
Read Answers (2) | Asked by : ambrishg
Tags : Abstract

How could I, in C++ declare a class point. The class point has two private data members x and y of type float. The class point has a parameterized constructor to initialize both the data members i.e. x and y. The class point has a member function display() that display the value of x and y. Create two objects p1 and p2 with your desired data and display the values of x and y of p1 and p2. Now create a third object p3 by using the expression p3=p1+p2 and display the values of x and y of p3.
Read Answers (1) | Asked by : attique

Why are private fields assigned with public properties?Is this not same as declaring the field Public?
View Question | Asked by : purba


 Sponsored Links

 
Related Articles

OOPS Tutorials

Object oriented programming OOP is a computer science term used to characterize a programming language that began development in the 1960’ s The term object oriented programming’ was originally coined by Xerox PARC to designate a computer application that describes the methodol
 

How Ajax Can Become as User Friendly as Flash

How Ajax Can Become as User Friendly as Flash There are a number of reasons why Flash has become so popular on the web today and this lies in the fact that users don t have to reload the page Products such as Flash Remoting will allow users to access the background server and Ajax can do the same th
 

The Inheritance Concept In OOPs

The Inheritance Concept In OOPs In object oriented programming objects will be characterised by classes It is possible to learn a lot about an object based on the class it belongs to Even if you are not familiar with the name Maybach If I told you it is a car you would immediately know that it has f
 

Understanding The Message Concept In OOPs

Understanding The Message Concept In OOPs To understand object oriented programming you will need to become familiar with messages As the name implies a message is a process in which software objects will communicate with one another Because of this having one object is not enough mosgoogle An objec
 

Basic concepts of OOPS and Structure of C++ program

Basic concepts of OOPS and Structure of C program In this tutorial you will learn about Objects Classes Inheritance Data Abstraction Data Encapsulation Polymorphism Overloading Reusability Before starting to learn C it is essential that one must have a basic knowledge of the concepts of Object orie
 





About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape