. , ints:
class Point {
public:
Point() : x( 0 ), y( 0 ) { }
Point( int _x, int _y ) : x( _x ), y( _y ) { }
};
Note: if you declare a constructor that accepts some arguments, then to create an instance, such as Point x;, you need to declare the default constructor yourself.
PS Just read Conrad's answer. Yes, you can use +=, not =for your members. :)
source
share