Class design question
From: Bill Thompson (billt61_at_ixnayontheamspayrgv.rr.com)
Date: 10/01/03
- Next message: Mike Wahler: "Re: <Help> Simple Pause Needed."
- Previous message: Jonathan Mcdougall: "Re: <Help> Simple Pause Needed."
- Next in thread: Jonathan Mcdougall: "Re: Class design question"
- Reply: Jonathan Mcdougall: "Re: Class design question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 30 Sep 2003 23:31:43 GMT
I'm creating a database application using MFC (Microsoft Foundation
Classes), Visual C++ 6.0. MFC has different classes for each type of data
entry control (e.g. edit boxes, combo boxes).
The interface to the database is the same for all these different control
types, e.g. when the user first attempts to change a value in a control,
attempt to lock the record, or when a control loses focus, attempt to write
the field value.
Since it appears I can't create a generic control class and derive combos
and edit boxes from that class, I'm using multiple inheritance; using
classes that wrap the MFC class and the generic database interface code, as
follows:
class CDbEditCtrl : public CEdit, public CDbControl
{
...
};
class CDbComboCtrl : public CComboBox, public CDbControl
{
...
};
where CEdit and CComboBox are MFC control classes, and CDbControl is the
database interface class.
This allows me to override virtual functions provided by MFC for event
handling etc, while using the generic CDbControl class to interface to the
database.
Could someone kindly suggest a better architecture or technique?
- Next message: Mike Wahler: "Re: <Help> Simple Pause Needed."
- Previous message: Jonathan Mcdougall: "Re: <Help> Simple Pause Needed."
- Next in thread: Jonathan Mcdougall: "Re: Class design question"
- Reply: Jonathan Mcdougall: "Re: Class design question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|