Encapsulation in C++

Source code :

#include <iostream>
class encap{
private:
int a;
public:
void print()
{
a=1;
std::cout<<"the varible has"<<a;
}
};
int main()
{
encap obj;
obj.print();

}

Output :

0

Output :


                

Comments :