bg287

csc210 2011 03 23 Notes

Posted in csc210 by bnmng on 2011 03/23

Lab next week.
Reading Assignment.

16.2 of Dale, and Main Savitch Chapter 6, section on Template Functions.

Today’s Agenda:
Pointers and Inheritance
Abstract and Base Classes
Template Classes from 16.1.

Composition vs Inheritance. Composition: no special syntax. Public functions are not available.

Inheritance: Special Syntax –

INheritance initializer has the name of the class after the colons; Composition has the name of the object.

Order of constructor calls: Base, Embedded, Derived. Destructors are called in opposit order.

When redefining functions in a derived class, it’s important to use ‘virtual’ in the base class to allow

Inline functions: The code is repeated throughout the main program.

Abstract Base Class: To define the functions in any derived class.
Pure virtual functions: Declare the function as virtual and assign it the value of zero.

See handout 2011 March 23 #1

Class member functions.
+ Each needs a template prefix
+ Nameofclass::

Organization of Program Code: Basically we need one big file. Cannot pre-compile cpp files. Specification file has to be .h, not .cpp because we can’t pre-compile it. Can be in separate files using an include statements. This is the same as including the entire text of one file into another.

-90

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: