diff --git a/Encapsulation.cpp b/Encapsulation.cpp new file mode 100644 index 0000000..e85ac12 --- /dev/null +++ b/Encapsulation.cpp @@ -0,0 +1,22 @@ +#include +using namespace std; + +class Employee { + private: + int salary; + + public: + void setSalary(int s) { + salary = s; + } + int getSalary() { + return salary; + } +}; + +int main() { + Employee myObj; + myObj.setSalary(50000); + cout << myObj.getSalary(); + return 0; +}