fork download
  1. #include<iostream>
  2. using namespace std;
  3.  
  4. // scope of the variables or objects
  5.  
  6.  
  7. class Point {
  8. // by default all the members of the class is private
  9. public:
  10. // constructor
  11. // special function
  12. // same name as that of the class
  13. // constructor without parameters
  14. // constructors gets called whenever we create an object of that class
  15. Point() { cout << "Constructor called"<<endl; }
  16.  
  17. // destructor
  18. };
  19.  
  20. int main()
  21. {
  22. Point t1;
  23. Point t2;
  24. Point t3;
  25. return 0;
  26. }
Success #stdin #stdout 0s 5496KB
stdin
Standard input is empty
stdout
Constructor called
Constructor called
Constructor called