netx_iit

used function defination outside class

Jul 15th, 2020 (edited)
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. /* used scope resolution operator
  2. 2.used function defination outside class*/
  3. #include<iostream>
  4. using namespace std;
  5. class demo
  6. {
  7.     public:
  8.         void disp();//declration
  9. };
  10. class demo2
  11. {
  12.     public:
  13.         void show();//declaration
  14. };
  15. void demo::disp()
  16. {
  17.     cout<<"I am disp method of demo class";
  18. }
  19. void demo2::show()
  20. {
  21.     cout<<"I am show method of demo1 class";
  22.    
  23. }
  24. int main()
  25. {
  26.     demo d1;
  27.     demo2 d2;
  28.     d1.disp();
  29.     d2.show();
  30. }
Advertisement
Add Comment
Please, Sign In to add comment