fork download
  1. // Online C compiler to run C program online
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. class student
  6. {
  7. private:
  8. int a, b;
  9. public:
  10. student(int x, int y)
  11. {
  12. a = x;
  13. b = y;
  14.  
  15. }
  16. void display();
  17.  
  18. };
  19.  
  20. void student::display()
  21. {
  22. cout<<"A is....."<<a;
  23. cout<<"A is....."<<b;
  24. }
  25.  
  26. int main()
  27. {
  28. student s(4,5);
  29. s.display();
  30. }
  31.  
Success #stdin #stdout 0.01s 5264KB
stdin
45
stdout
A is.....4A is.....5