CS 340 - 1/22/13 Writing code inside of the class definition causes that method to be considered as inline. class Point { .... inline int x(); } inline int Point::x() { return x_; } In C++, every class has a default constructor and a default destructor. Constructor is a section of code executed when an instance of a class come into scope. Destructor is a section of code executed when an instance of a class goes out of scope. Scope: section of code in which an identifier can be used Types of memory (from the Point of View of a program) - dynamic (heap) - automatic (program stack) - static - allocated at load time deallocated at termination time Constructor: default constructor takes Zero parameters class Point { .... Point (); // default constructor Point (int , int); ~Point (); // destructor }; Point::Point() { x_ = 0; y_ = 0; } Point::Point(int a, int b) { x_ = a; y_ = b; } Point::~Point() { cout << "Destructor for the point instance (" << x_ << "," << y_ << ") was called." << endl; }