Introduction to OOP: Chapter 4: Messages, Instances, and Initialization: [next] [previous] [audio] [real] [text]

Constructor Implementation

A constructor is implemented like any other function, only no return type is specified.


class Card {
public:
		// constructor
	Card (Suits sv, int rv) {
		s = sv; // set suit
		r = rv; // set rank
		faceup = false; // start out face down
	}
	...

};

Intro OOP, Chapter 4, Slide 14