Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!dali.cs.montana.edu!milton!bytor@milton.u.washington.edu From: bytor@milton.u.washington.edu (Jill Patterson) Newsgroups: comp.lang.c++ Subject: Multiple Inheritance Message-ID: <9528@milton.u.washington.edu> Date: 18 Oct 90 23:08:16 GMT Sender: bytor@milton.u.washington.edu Distribution: na Organization: University of Washington, Seattle Lines: 86 Hi, I'm trying to figure out some base classes for some graphical objects I'm working on. This is what I have so far: class Point { public: virtual short x() {return 0;} virtual short y() {return 0;} virtual double wx() {return 0.0;} virtual double wy() {return 0.0;} virtual double theta() {return 0.0} virtual double radius() {return 0.0;} }; class PhysicalPoint : Point { private: short xCoord; short yCoord; public: PhysicalPoint() { xCoord = 0; yCoord = 0; } PhysicalPoint(short x, short y) { xCoord = x; yCoord = y; } virtual short x() {return xCoord;} virtual short y() {return yCoord;} }; class LogicalPoint : Point { private: double wxCoord; double wyCoord; public: LogicalPoint() { wxCoord = 0.0; wyCoord = 0.0; } LogicalPoint(double wx, double wy) { wxCoord = wx; wyCoord = wy; } virtual double wx() {return wxCoord;} virtual double wy() {return wyCoord;} } class Rectangle { Point *UpLt; Point *DnRt; Rectangle(Point *ul, Point *dr) { UpLt = ul; DnRt = dr; } }} Now with the above definitions I should be able to do this (in TC++) right? LogicalPoint *lPoint = new LogicalPoint(10.0, 10.0); LogicalPoint *lPoint2 = new LogicalPoint(30.0, 30.0); PhysicalPoint *pPoint1 = new PhysicalPoint(10, 10); PhysicalPoint *pPoint2 = new PhysicalPoint(30, 30); Rectangle lRect(lPoint1, lPoint2); Rectangle pRect(pPoint1, pPoint2); By doing this I should get either a Rectangle with short coordinates or a Rectangle with double coordinates correct? But I can't seem to get them to work, HELP! --------------------- bytor@milton.u.washington.edu