Advertisement
TechOPGOHIL

Untitled

Dec 3rd, 2023
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. // Write A program to perform member function in side ther clss as well as out side the class.
  2.  
  3. #include<iostream.h>
  4. #include<conio.h>
  5. class opgohil
  6. {
  7.     int a,b;
  8.     public:
  9.     void getdata()
  10.     {
  11.         cout<<"\nEnter Value 1 :";
  12.         cin>>a;
  13.         cout<<"\nEnter Value 2 :";
  14.         cin>>b;
  15.     }              // declare member function inside the class
  16.     void display(); // display member function out side the class
  17. };
  18. void opgohil :: display()
  19. {
  20.     cout<<"\nValue 1 is : "<<a;
  21.     cout<<"\nValue 2 is :"<<b;
  22. }
  23. void main()
  24. {
  25.     clrscr();
  26.     opgohil o;
  27.     o.getdata();
  28.     o.display();
  29.     getch();
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement