fork download
  1. #include<iostream>
  2. using namespace std;
  3. class Class_Name{
  4. private:
  5. int a,b;
  6. public:
  7. Class_Name(int aa,int bb)
  8. {
  9. cout<<"constructor ic called:"<<endl;
  10. a=aa;
  11. b=bb;
  12. cout<<"value of a:"<<a<<endl;
  13. cout<<"value of b:"<<b<<endl;
  14. cout<<endl;
  15. }
  16. ~Class_Name()
  17. {
  18. cout<<"destructor is called:"<<endl;
  19. cout<<"value of a:"<<a<<endl;
  20. cout<<"value of b:"<<b<<endl;
  21. }
  22. };
  23. int main(){
  24. Class_Name obj(5,6);
  25. return 0;
  26. }
  27.  
  28.  
  29.  
  30.  
Success #stdin #stdout 0.01s 5304KB
stdin
 
stdout
constructor ic called:
value of a:5
value of b:6

destructor is called:
value of a:5
value of b:6