Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. // Example program
  2. #include <iostream>
  3. #include <string>
  4. using namespace std;
  5.  
  6. class A{
  7. public:
  8. static int a; // Static Variable
  9.  
  10. //static function
  11. static int doPrint(){
  12. cout<<a;
  13. return 0;
  14. }
  15.  
  16. };
  17.  
  18. int A::a = 10;
  19.  
  20. int main()
  21. {
  22.  
  23. cout<<A::a;
  24. A::doPrint();
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement