Lecture overview -- Keyboard shortcut: 'u'  Previous page: More about constructors -- Keyboard shortcut: 'p'  Next page: Destructors -- Keyboard shortcut: 'n'  Lecture notes - all slides together  Annotated slide -- Keyboard shortcut: 't'  Alphabetic index  Help page about these notes  Course home    Abstraction Mechanisms, Part 1 - slide 8 : 36

Use of constructors

We illustrate the use of overloaded constructors - both with 'static allocation' and 'dynamic allocation'

In order to distinguish the use of the individual constructors they carry out 'funny Point initializations'

point.h
Class Point with a variety of constructors.
point.cc
Funny implementations of constructors.
prog2.cc
Use of constructors - with automatic variables of class type.
program-output
Actual program output.
prog2-more.cc
An additional Point construction attempt - a trap.
Go to exercise
Use of constructors with object on the free store