From: Hyman Rosen <hyrosen@mail.com>
Subject: Re: more to ada paper critic
Date: Mon, 17 Jun 2002 14:07:21 -0400
Date: 2002-06-17T14:07:21-04:00 [thread overview]
Message-ID: <3D0E2559.1080909@mail.com> (raw)
In-Reply-To: 4519e058.0206170923.5b278bfe@posting.google.com
Ted Dennison wrote:
> This must be a C++ idiom with which I'm unfamiliar. I thought C++
> class declarations did not allow any part of the class's declaration
> (like one of its fields) to be declared in a separate compilation.
You're right. I think he's talking about the so-called "pimpl" technique,
which isolates the implementation of a class into a file which is never
seen by the user. The user only sees a class which has a set of methods,
and one pointer to an implementation class.
//-----widget.h-------
class WidgetImpl; // forward declare class
class Widget
{
auto_ptr<WidgetImpl> pImpl; // OK for WidgetImpl to be incomplete type
public:
Widget();
void method1();
void method2();
};
//-----widget.cpp-----
class WidgetImpl
{
public:
void method1() { }
void method2() { }
};
Widget::Widget() : pImpl(new WidgetImpl) { }
void Widget::method1() { pImpl->method1(); }
void Widget::method2() { pImpl->method2(); }
next prev parent reply other threads:[~2002-06-17 18:07 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-06-17 10:28 more to ada paper critic Immanuel Scholz
2002-06-17 17:23 ` Ted Dennison
2002-06-17 18:07 ` Hyman Rosen [this message]
2002-06-18 1:50 ` Ted Dennison
2002-06-18 5:38 ` Eric G. Miller
2002-06-18 13:42 ` Immanuel Scholz
-- strict thread matches above, loose matches on Subject: below --
2002-06-17 11:33 Grein, Christoph
2002-06-17 15:16 Gautier direct_replies_not_read
2002-06-17 15:26 Gautier direct_replies_not_read
2002-06-18 13:30 ` Immanuel Scholz
2002-06-18 13:35 ` Steve O'Neill
2002-06-18 17:59 ` Christoph Schlegel
2002-06-19 20:41 ` Immanuel Scholz
2002-06-20 19:39 ` Christoph Schlegel
2002-06-19 16:05 ` Britt Snodgrass
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox