What do you mean by public, private, protected and friendly?

Showing Answers 1 - 1 of 1 Answers

samiksc

  • Jan 24th, 2006
 

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.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions