Newsgroups: comp.lang.c++,comp.object,comp.theory,comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!cam-news-feed3.bbnplanet.com!cam-news-hub1.bbnplanet.com!news.bbnplanet.com!news.maxwell.syr.edu!news.mathworks.com!uunet!in3.uu.net!128.100.1.3!utcsri!info.ecf!doylep
From: doylep@ecf.toronto.edu (Patrick Doyle)
Subject: Re: Opinions on Ellipse-Circle dilemma?
Sender: news@ecf.toronto.edu (News Administrator)
Message-ID: <E5ICJK.GII@ecf.toronto.edu>
Date: Wed, 12 Feb 1997 20:50:08 GMT
Distribution: inet
X-Nntp-Posting-Host: spark21.ecf
References: <5d4fmf$7gk@bagan.srce.hr> <u8rvi86ntcx.fsf@miris10.leeds.ac.uk> <32FA2A1C.6B31@arscorp.com> <01bc1856$23624c70$5f030514@dschauma>
Organization: University of Toronto, Engineering Computing Facility
Lines: 50
Xref: glinda.oz.cs.cmu.edu comp.lang.c++:247494 comp.object:61059 comp.theory:17923 comp.lang.smalltalk:51486

In article <01bc1856$23624c70$5f030514@dschauma>,
Dave Schaumann <dschauma@csci.csc.com> wrote:
>
>Maybe I'm missing something, but isn't this what private inheritance is
>for? (in C++,
>anyway -- I have no idea if this sort of thing is available in other
>languages).

  I think you're missing something.  :-)

>	class ellipse {
>	public:
>	  void SetFocusA (point a);
>	  void SetFocusB (point b);
>	};
>
>
>	class circle : private ellipse {
>	public:
>	  void SetCenter(point center) { SetFocusB(center); SetFocusB(center); }
>	};
>
>	void foo()
>	{
>	  circle c;
>	  point a;
>
>	  c.SetCenter(a); // OK; public method on class circle
>	  c.SetFocusA(a); // error; public method on privately inherited class
>	}

  Ok, let me add this:

void RefocusAnEllipse(ellipse *E, point a, point b){
  E->SetFocusA(a);
  E->SetFocusB(b);
}

...

RefocusAnEllipse(MyCircle, 10, 20);

  This last call will cause problems.  I know this is a simple example with
a simple solution, but it's still a valid problem.

 -PD
-- 
--
Patrick Doyle
doylep@ecf.utoronto.ca
