Next:
Contents
Experiments in Object Oriented Design: Simple Beginnings: Version 1.0
Jim Peterson
February 3, 1999
Contents
Introduction:
Why Should We Care?
Background Reading and Study:
Our First Attempt at Designing a Class: Matrix Objects:
The Basics of the Class Object MYOBJECT:
The Integer Matrix Class Design:
The Full Header File: int_matrix.h:
The Header File With Comments Removed: int_matrix.h:
The Abbreviated Header File With No Agents:
The Annotated Header File: int_matrix.h:
Shrouding The Header File:
Including Standard Headers:
How To Set The Type of the Matrix Class:
How to Control Diagnostic Prints:
The Syntax For an Object Definition:
Friend Agents:
The General Structure of the Header File:
The Explicit Constructor:
The Default Constructor:
The Copy Constructor:
The Destructor:
The Overloaded Equal Operator:
the Overloaded + Operator:
The Overloaded + = Operator:
The Overloaded - Operator:
The Overloaded - = Operator:
The Overloaded * Operator:
The Overloaded = = Operator:
The Overloaded ! = Operator:
The Overloaded [] Operator:
The Get rowsize Agent:
The Get columnsize Agent:
The Get outputFile Agent:
The Get inputFile Agent:
The Matrix Class as a Vector of Vectors:
The Integer Vector Class:
The Header File: int_vector.h:
The Source Code: int_vector.c:
The Integer Vector-Vector Class:
The Header File: int_vector_vector.h:
The Source Code: int_vector_vector.c:
Some Run-Time Results:
Creating a Matrix Application by Class Derivation:
Basic Class Design Revisited:
Privacy Issues Abound!
Some Application Agents:
Solve Methods:
FLOAT_MATRIX_APPS solve(FLOAT_MATRIX_APPS& B);
FLOAT_VECTOR solve(FLOAT_VECTOR& B);
Matrix Inversion:
FLOAT_MATRIX_APPS inverse();
FLOAT_MATRIX_APPS augmented(FLOAT_MATRIX_APPS& B);
FLOAT_MATRIX_APPS augmented(FLOAT_VECTOR& B);
Calculating the Determinant:
FLOAT_MATRIX_APPS cofactor(int i,int j);
FLOAT det();
Typcial Run-Time Results:
Miscellaneous Operations:
void row_operation();
void scale_row(FLOAT a,int i);
void swap_rows(int i,int j);
void swap_columns(int i,int j);
FLOAT_MATRIX_APPS get_column(int i,int j);
FLOAT_VECTOR get_column(int i);
Some Results:
Application Source:
Run-Time Results:
Simple Shapes as Objects:
Our First BOX Class:
The BOX Header file:
The Actual BOX Class Code:
Creation and Destruction Functions:
The Method Code:
A Small Application:
Designing a CIRCLE Class:
Our First Attempt at the CIRCLE Class:
The CIRCLE Header file:
The Actual CIRCLE Class Code:
Creation and Destruction Functions:
The Method Code:
A Small Application:
Our First Attempt at Designing a Class Hierarchy:
What is Common to the CIRCLE and BOX classes?
Organizing The Common Class Elements Into the SHAPE Class:
The SHAPE Header File: shape.h
The Actual SHAPE Class Code:
Creation and Destruction Functions:
Deriving the BOX Class from SHAPE:
The Derived BOX Header File: box.h
The Actual Derived BOX Class Code:
Creation and Destruction Functions:
The Method Code:
A Small Application: Using the Derived BOX Directly:
Another Application: Creating BOX Vectors:
A First Look at Dynamic Binding:
Deriving the CIRCLE Class from SHAPE:
The CIRCLE Header File: circle.h
The Actual Derived CIRCLE Class Code:
Creation and Destruction Functions:
The Method Code:
Another Look at Dynamic Binding:
Sigmoidal Processing with Dynamically Bound Engines:
The Traditional Sigmoidal Processing:
The General SOMA Object Approach:
The Class Code:
The Header Files:
SOMA header file: soma.h:
SIGMOIDAL header file: sigmoidal.h:
RAMP header file: ramp.h:
Source Code for SOMA Class:
SOMAclass: create_construct.c:
SOMAclass: create_copy.c:
SOMAclass: create_default.c:
SOMAclass: equal.c:
SOMAclass: destroy.c:
Source Code for SIGMOIDAL Class:
SIGMOIDALclass: create_construct.c:
SIGMOIDALclass: create_copy.c:
SIGMOIDALclass: create_default.c:
SIGMOIDALclass: equal.c:
SIGMOIDALclass: delete.c:
SIGMOIDALclass: compute_value.c:
Source Code RAMP Class:
RAMPclass: create_construct.c:
RAMPclass: create_copy.c:
RAMPclass: create_default.c:
RAMPclass: equal.c:
RAMPclass: delete.c:
RAMPclass: compute_value.c:
Exercising the Class Code: An Application:
Application code: main.c
Source Code Annotations:
Runtime sigmoidal Output and ramp Output:
An Alternate Application with Local Scoping:
Source Code:
Runtime Output for Local Scoping:
Dynamic Binding:
The SHAPE Class Application:
References:
About this document ...
Jim Peterson
1999-04-22