How are private members of a class different from public members?
Answers
Answered by
5
Explanation:
⭕ A public member is accessible from anywhere outside the class but within a program.
⭕ You can set and get the value of public variables without any member.
⭕A private member variable or function cannot be accessed, or even viewed from outside the class.
⭕Only the class and friend functions can access private members.
Answered by
10
Explanation:
A public member is accessible from anywhere outside the class but within a program. You can set and get the value of public variables without anymember. A private member variable or function cannot be accessed, or even viewed from outside the class. Only the class and friend functions can access private members.
Similar questions
English,
6 months ago
India Languages,
6 months ago
Math,
11 months ago
Computer Science,
11 months ago
English,
1 year ago