Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!sdd.hp.com!spool.mu.edu!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!isgate!krafla!aries From: aries@rhi.hi.is (Mimir Reynisson) Newsgroups: comp.sys.mac.programmer Subject: Re: C++ method overriding Message-ID: <2839@krafla.rhi.hi.is> Date: 27 Feb 91 10:28:27 GMT References: <2831@krafla.rhi.hi.is> <1991Feb25.214458.11837@ux1.cso.uiuc.edu> Organization: University of Iceland Lines: 66 >Constructors always call functions of their own class, even if the functions >are virtual and overloaded. For that matter, since constructors should >be inittializing info, it's not necessarily such a good idea to have them >calling other functions. Just create a new constructor for the subclass and >you'll be set. Yup. I did something like that shortly after I posted my article. What I was actually doing was plain silly - too little sleep and too much coffee, I presume. Anyway, now there is another impending problem. Well it's not actually a problem, it's rather a nucance. Look at this code fragment: doDrawSomething() { Rect bounds; SetRect(&bounds, 10, 10, 50, 50); // Draw a rectangle FrameRect(&bounds); MoveTo(bounds.left+1,bounds.botom); // Shade the rectangle LineTo(bounds.right,bounds.bottom); LineTo(bounds.right,bounds.top+1); }; On my planet that does do what it's supposed to do. The shading is not even near the rectangle let alone in the correct shape. To get the right shading I'll have to do the following: doDrawSomething() { Rect bounds; short h,v; SetRect(&bounds, 10, 10, 50, 50); // Draw a rectangle FrameRect(&bounds); h=bounds.left; MoveTo(h+1,bounds.botom); // Shade the rectangle LineTo(bounds.right,bounds.bottom); v=bounds.top; LineTo(bounds.right,v+1); }; Or something like this: doDrawSomething() { Rect bounds; short h,v; SetRect(&bounds, 10, 10, 50, 50); // Draw a rectangle FrameRect(&bounds); h=bounds.left+1; MoveTo(h,bounds.botom); // Shade the rectangle LineTo(bounds.right,bounds.bottom); v=bounds.top+1; LineTo(bounds.right,v); }; Can anybody please point out to me what is bogus with my code? --MymR