[an error occurred while processing this directive]
Object-Oriented C Programming
Construction Zone - Web site under construction.
-
Object-Oriented Terminology
Read this first if you are new to object-oriented methodology.
-
Implementing an Object in C
This web page describes the basic idea of implementing objects in C and
uses a simplified stack object as an example.
-
Implementing a Class in C
This web page describes the basic idea of implementing classes in C and
uses a simplified stack class as an example.
-
A Complete Stack Object and Stack Class
This web page describes complete implementations for both a stack object
and a stack class.
-
An Improved Stack Object and Stack Class
This web page describes how to use realloc()
to remove the
stack size limit from the previous examples.
-
A Stack Class with References
In the previous examples, stacks are value objects.
This means that when you assign a stack to a variable, you get a
copy of the assigned stack.
This web page describes a class of stack references.
This means that when you assign a stack to a variable, you get another
reference to the same stack.
This web page also discusses reasons for converting to references.
-
A Stack Class with Opaque Type
This web page describes how to use opaque types to keep the declaration of
an object struct out of the header file.
This ensures that clients cannot access stack data except through
functions, resulting in greater data integrity.
-
Function Parameters in C
This web page describes how function parameters work in C.
In C, a function can be treated as data: it can be the value of a variable,
or a parameter, or a member of a struct.
A C programmer can also define types for functions.
This capability can be used as a mechanism to implement polymorphism.
-
Function Parameters in the C Standard Library
This web page describes two examples of function parameters in the C
Standard Library: the bsearch()
function and the
qsort()
function.
Both functions have function parameters for comparing two data items.
These parameters allow different kinds of searches or sorts to be performed
using the same search or sort function.
-
UNIX Streams
This web page describes how polymorpism was implemented in UNIX streams
using functions as members of structs.
This allows output from a program to be sent to the screen, redirected to a
local file, redirected to a network file, or piped to another program.
[an error occurred while processing this directive]