Create a free account on Computer Sir Ki Class and unlock access to valuable learning resources.
Exam Paper Downloads: After registering and logging in, you can download exam question papers in PDF format to practice and prepare for your exams.
Student Support: Get assistance with your doubts, queries, and questions related to your studies. Our support is here to help you understand topics and resolve your learning difficulties.
Register today and make your exam preparation easier and more effective!
Differentiate between private and public members of a class in context of Object Oriented Programming. Also give a suitable example illustrating accessibility/non-accessibility of each using a class and an object in C++.
Answer:
private
public
Implicit Visibility Mode
Explicit Visibility Mode
Not accessible by the objects of class
Accessible by the objects of class
Example:
class A
{
int x; //private Member
public:
void In(); //public member
};
void main()
{
A obja;
cin>>obja.x; //Not Accessible
obja.In(); //accessible
}
C. Sir| Created: 8-Jan-2019 | Updated: 22-Mar-2026|CBSE12D-2017