[ 11.html ]
You can do this material as a part of CSCI330.
and do Review Questions.
These are very helpful but the syntax is a mess. As a result ALWAYS
copy/paste the header for a working example and modify it to
fit the new class. I do not want you to waste time memorizing this
syntax. It will not be on any quizzes or the final. However you
do need to be able to remember what it means if I give you a correct example.
Here is the source code for this chapter
[ fraction.cpp ]
[ fraction.h ]
[ fractiontest.cpp ]
Makefile for fractions:
fractiontest: fractiontest.cpp fraction.h fraction.o
g++ -w -o fractiontest fraction.o fractiontest.cpp
fraction.o: fraction.h fraction.cpp
g++ -w -c fraction.cpp
(Matrices): The first cut
[ matrix1.cpp ]
[ matrix1.h ]
[ matrixtest1.cpp ]
Hand in one even numbered question+answer at the start of class.
Hand in what you have for Project 2.
(the C++ motto)
Chapter 10,11,12, algorithm, P2
[ 13.html ]
With overloading you should be careful to choose the right operators to be
overloaded for each class you write. It is OK to have none. You should
think about the meaning of the objects and whether an operator makes sense or not.
For example -- you create a class called Time that represents time of day ...
what operators should you define for it, which operators should you not define?
What operators make sense for Dates.
Next project due in class 17.
Next quiz in class 17.
Mathematicians have pointed out to me that the C++ language allows you
to define implementations of abstract algebra. For example, a
group might have a definition like this
Group operator+(Group other);
static Group zero();
BUT -- this is only true if the operators are implemented to follow the axioms
that define a group --
- For all a,b,c:Group
- For 0:=Group.zero().
- a+(b+c) == (a+b)+c.
- a+0 == a.
- a+(-a) == 0.
- accessor::=`A Function that accesses information in an object with out changing the object in any visible way".
In C++ this is called a "const function".
In the UML it is called a query.
- Algorithm::=A precise description of a series of steps to attain a goal,
[ Algorithm ]
- class::="A description of a set of similar objects that have similar data plus the functions needed to manipulate the data".
- constructor::="A Function in a class that creates new objects in the class".
- Data_Structure::=A small data base.
- destructor::=`A Function that is called when an object is destroyed".
- Function::programming=A selfcontained and named piece of program that knows how to do something.
- Gnu::="Gnu's Not Unix", a long running open source project that supplies a
very popular and free C++ compiler.
- mutator::="A Function that changes an object".
- object::="A little bit of knowledge -- some data and some know how". An
object is instance of a class.
- objects::=plural of object.
- OOP::="Object-Oriented Programming",
Current paradigm for programming.
- Semantics::=Rules determining the meaning of correct statements in a language.
- SP::="Structured Programming",
a previous paradigm for programming.
- STL::="The standard C++ library of classes and functions" -- also called the
"Standard Template Library" because many of the classes and functions will work
with any kind of data.
- Syntax::=The rules determining the correctness and structure of statements in a language, grammar.
- Q::software="A program I wrote to make software easier to develop",
- TBA::="To Be Announced", something I should do.
- TBD::="To Be Done", something you have to do.
- UML::="Unified Modeling Language".
- void::C++Keyword="Indicates a function that has no return".