Lecture overview -- Keyboard shortcut: 'u'  Previous page: Functions outside classes -- Keyboard shortcut: 'p'  Next page: Constructors - C++11 -- Keyboard shortcut: 'n'  Lecture notes - all slides together  Alphabetic index  Help page about these notes  Course home    Abstraction Mechanisms, Part 1 - slide 6 : 41

Constructors

The name of a constructor is the same as the name of its class or struct.

Constructors in C++ are in many ways similar to constructors in C# and Java

point.h
The Point class.
point.cc
Implementation of the Point class constructors.
rect.h
The Rectangle class.
rect.cc
Implementation of the Rectangle class constructors.
prog.cc
Sample Rectangle constructions.
Go to exercise
Methods in class Point and class Rectangle
point-constructors-problems.cc
Illustration of legal and illegal member initializers - constructor chaining is not supported.