Find which of the following uses encapsulation?
(a) void main(){ int a; void fun( int a=10; cout<<a); fun(); }
(b) class student{ int a; public: int b;};
(c) class student{int a; public: void disp(){ cout<<a;} };
(d) struct topper{ char name[10]; public : int marks; }
The question was asked by my college professor while I was bunking the class.
My question comes from Encapsulation in chapter OOPs Concept & Features of Object Oriented Programming