20-CS-122-001 Computer Science II Spring 2012
Classes - Index to all files

Virtual functions, classes, inheritance, lists, queues, stacks, applications

C++ class examples

CodeDescription
Simple Structure Simple illustration of a struct (see power point demo)
Simple class 0 Simple illustration of a class, only data, no methods
Simple class 1 Same class as above with a constructor
Simple class 2 Same class as above with a method
Simple class 3 Same class as above except that data is now private
Simple class 4 But even though data is "private" C++ can be tricked into revealing it
Sophisto class 0 Simple API presented to user, complex process hidden, dynamic memory (see power point demo)
Sophisto class 1 Same as above with destructor to reclaim dynamically allocated memory after object deleted
Sophisto class 2 Same as above, destructor is invoked when OS deletes sophisto object
Subroutine Calls Parameter passing by value, reference, name (see power point demo)
Prototyping 0 Separate class specification from the code - Spec goes to include file
Prototyping 1 Strings require asking OS for space - must use a destructor
Copy Constructor 0 For parameter passing, overloaded =
Copy Constructor 1 More of the same
Simple class 5 Another simple class which retains info to be updated
Simple class 6 Same idea as above but more complex
List class 0 Maintain a list of objects - add any object to rear, allow removal (see power point demo)
  list.h
  list.cc
List class 1 Same as above except that the list object is not created via call to new
List class 2 Same as above except list uses a tail pointer
  list.1.h
  list.1.cc
List class 3 Shows that objects of different classes can easily be put into a List
List class 4 Same as above except that the list object is not created via call to new
List class 5 Same as above - remove objects from list
List class 6 Use constructor to bring in disp and find functions for adaptability
List class 7 Overload list operators
  list.0_1.h
  list.0_1.cc
Biginteger 0 List of biginteger objects
  bigint.h
  bigint.cc
BigInteger 1 Same as above except that the list object is not created via call to new
BigInteger 2 Use BigInteger class to help with the functions (first attempt)
  bigint.1.h
  bigint.1.cc
BigInteger 3 Overloading the "*" oper ator for BigInteger class
Doubly Linked List 0 Use a doubly linked list
  list.2.h
  list.2.cc
Doubly Linked List 1 Use a doubly linked list
  list.3.h
  list.3.cc
Overload 0 Overload = operator plus complicated data type
Fraction class 0 Fraction class (see power point gcd demo)
Fraction class 1 Slight changes to the above
Fraction class 2 Add copy constructor
Fraction class 3 Heavy operator overloading
Fraction class 4 Heavy operator overloading
Fraction class 5 Heavy operator overloading
  frac.3.h
  frac.3.cc
Fraction class 6 Heavy operator overloading
  frac.h
Fraction class 7 Heavy operator overloading
  frac.1.h
Date class A date class
Param Pass Example of parameter passing (see power point demo)
SupportDescription
bigint.cc Arbitrarily large integers
bigint.h Include file for above
bigint.1.cc Arbitrarily large integers
bigint.1.h Include file for above
biginttest.cc Test the above
list.cc Maintain lists of objects, basic list ops (see power point queue and list demos)
list.h Include file for above
list.0.cc Maintain lists of objects, uses "disp" and "find" pointers to functions
list.0.h Include file for above
list.1.cc Maintain lists of objects, basic, uses tail pointer for quick insertion
list.1.h Include file for above
list.2.cc Maintain lists of objects, advanced, uses tail pointer
list.2.h Include file for above
list.3.cc Maintain lists of objects
list.3.h Include file for above
list.0_1.cc Maintain lists of objects, heavy operator overloading
list.0_1.h Include file for above
Makefile Makefile for all code on this page
Power Point
Operator = The = operator for structs is not overloaded
Param pass Illustration of passing parameters, copy constructors
List Describes the List abstraction
Queue Describes the Queue abstraction
GCD Describes the greatest common divisor algorithm