Advertisement
Felanpro

Encapsulation

Jan 22nd, 2016
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. /*An easy explained view of Encapsulation in C++.*/
  2.  
  3. #include "stdafx.h"
  4. #include <iostream>
  5. using namespace std;
  6.  
  7. class Random_Class
  8. {
  9. public:
  10.     void publicFunction()
  11.     {
  12.         privateFunction();
  13.     }
  14.  
  15. private:
  16.     void privateFunction()
  17.     {
  18.         cout << "Random text!!!" << endl;
  19.     }
  20.  
  21. };
  22.  
  23. int main()
  24. {
  25.     Random_Class object1;
  26.  
  27.     object1.publicFunction();
  28.  
  29.     return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement