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

 Print  |  
Question:   What do you mean by public, private, protected and friendly?



January 01, 2006 07:21:09 #1
 Sameeksha Microsoft Expert  Member Since: October 2005    Total Comments: 231 

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.
     

 

Back To Question