Classes - Implementation of Associations

Classes - Implementation of Associations -...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Uses // Race.h #include "Racetrack.h" class Race { public:      Race(Racetrack &);      void go(); private:      Racetrack & rt;      // private data members and utility functions to       // conduct the race simulation }; // Race.cpp :rt(r) {} void Race::go() {      // some code that calls utility functions      // and uses rt to run the race }; // main.cpp #include <cstdlib> #include "Racetrack.h" void main() {      system("pause");      Racetrack rt;      Race r(rt);      r.go(); } Race Racetrack Uses
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
// Race.h #include "Racetrack.h" class Race { public:      void go(); private:      Racetrack rt;      // other private data members and utility functions to       // conduct the race simulation. these utility functions      // have access to the class-scoped rt object }; Composition (has-a) Strict Aggregation Race Racetrack
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/25/2011 for the course CIS 554 taught by Professor Staff during the Spring '08 term at Syracuse.

Page1 / 5

Classes - Implementation of Associations -...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online