class event { event
protected:
event(event* x) : ev(x) {}
public:
int type() { return ev->type(); }
void* rawevent() { return ev; }
private:
event* ev;
};
class xevent : public event { X
public:
int type() { return X->type(); }
private:
struct XEvent* X;
};
slide: Hiding in C++
For example, as depicted in
slide [9-cc-hide],
we may offer the user a class event
which records information concerning
events occurring in a window environment,
while hiding completely the underlying
implementation.
The actual xevent class realizing the type
event may itself need access to other
structures,
as for example those provided by the X window
environment.
Yet, the xevent class itself may remain entirely
hidden from the user, since events
are not something created directly
(note the protected constructor)
but only indirectly,
generally by the system in response
to some action by the user.
[]
readme
course
preface
1
2
3
4
5
6
7
8
9
10
11
12
appendix
lectures
resources
eliens@cs.vu.nl

draft version 0.1 (15/7/2001)