473,396 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Class design question

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?

Jul 19 '05 #1
2 1981
> 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).

http://www.parashift.com/c++-faq-lit...t.html#faq-5.9
Jonathan
Jul 19 '05 #2
"Jonathan Mcdougall" <jo***************@DELyahoo.ca> wrote in message
news:%J*********************@weber.videotron.net.. .
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).

http://www.parashift.com/c++-faq-lit...t.html#faq-5.9
Jonathan


I should probably have gone to comp.object. Thanks for taking the time to
post the faq link.
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

50
by: Dan Perl | last post by:
There is something with initializing mutable class attributes that I am struggling with. I'll use an example to explain: class Father: attr1=None # this is OK attr2= # this is wrong...
13
by: Bryan Parkoff | last post by:
I have created three classes according to my own design. First class is called CMain. It is the Top Class. Second class and third class are called CMemory and CMPU. They are the sub-classes....
15
by: Steven T. Hatton | last post by:
The following may strike many of you as just plain silly, but it represents the kind of delelima I find myself in when trying to make a design decision. This really is a toy project written for...
3
by: fernandez.dan | last post by:
I'm still learning how to use Object Oriented concepts. I'm have a basic question dealing with design. I have two classes that deal with I/O pertaining to network and usb that inherit from an...
1
by: Alfonso Morra | last post by:
if I have a class template declared as ff: (BTW is this a partial specialization? - I think it is) template <typename T1, myenum_1 e1=OK, my_enum_2=NONE> class A { public: A(); virtual...
11
by: dimension | last post by:
If my intentions are to create objects that encapsulates data rows in a table, is it better to use a Struct or Class? Based on what i read, if my objects will simply have get and set methods,...
6
by: rodchar | last post by:
Hey all, I'm trying to understand Master/Detail concepts in VB.NET. If I do a data adapter fill for both customer and orders from Northwind where should that dataset live? What client is...
43
by: Tony | last post by:
I'm working with GUI messaging and note that MFC encapsulates the message loop inside of a C++ class member function. Is this somehow inherently less robust than calling the message loop functions...
6
by: JoeC | last post by:
I have a question about designing objects and programming. What is the best way to design objects? Create objects debug them and later if you need some new features just use inhereitance. Often...
29
by: Brad Pears | last post by:
Here is a simple OO design question... I have a Contract class. The user can either save an existing contract or they start off fresh with a blank contract, fill in the data and then save a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.