13.07.2015 Views

BABAR C++ Course Running the Examples - HEPHY

BABAR C++ Course Running the Examples - HEPHY

BABAR C++ Course Running the Examples - HEPHY

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Surface classPlane classPart of <strong>the</strong> headerclass Surface{protected:ThreeVec origin; // origin of Surfacepublic:Surface() : origin() {}Surface( const ThreeVec& o ) : origin( o ) {}virtual ~Surface() {}Surface( const Surface& s ) {origin = s.origin; }virtual double distanceAlongRay(int which_way, const Ray* ry, ThreeVec& p ) const = 0;virtual double distanceAlongHelix(int which_way, const Helix* hx, ThreeVec& p ) const = 0;// more not shown};Part of headerclass Plane: public Surface{public:Plane( const Point& origin, const Vector& n );Plane( const Point& origin, const Vector& nhat,double dist );// more not shownprivate:double d;// offset from origin to surface};• Plane is infinite since it has no data members todescribe boundary• we see usually constructors and destructors• <strong>the</strong> distanceAlong member functions are purevirtual• an instance of Surface can not be instanciated• Surface exists to define an interface<strong>BABAR</strong> <strong>C++</strong> <strong>Course</strong> 174 Paul F. Kunz<strong>BABAR</strong> <strong>C++</strong> <strong>Course</strong> 175 Paul F. Kunz

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!