Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Inheritance and message maps/data exchanges

Posted on 2009-06-29
2
327 Views
Last Modified: 2013-12-14
Hello,

I'm writing an MFC app. There are many "add" and "edit" dialogs for various record types, with a lot of redundant repetition - obvious candidates for refactoring so that each inherits from a common base class.

I have concerns about mixing inheritance with MFC's message/command routing. I seemingly cannot put a messagemap or data exchange in my base class.

Must I maintain mappings and data exchanges in my derived classes? It would be convenient to push that up into the base class.

Regards,
Sternocera
0
Comment
Question by:sternocera
2 Comments
 
LVL 31

Accepted Solution

by:
Zoppo earned 500 total points
ID: 24737444
Hi sternocera,

IMO there shouldn't be a problem using message maps/data exchange with base- and derived dialog classes. This method is even used in MFC, i.e. CFileDialog is derived from CCommonDialog which is derived from CDialog - all of them have their own message map.

You have to take care that in derived dialog classes you call the correct base-class functions. And it maybe that class-wizard doesn't support to add message handlers/variables as used with CDialog derived classes, so maybe you have to add them manually.

Hope that helps,

ZOPPO
0
 

Author Comment

by:sternocera
ID: 24738079
Zoppo,

I see. Thanks for that,

Regards,
Sternocera
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
installing and using WTP plugin eclipse MARS 3 124
matchUp  challenge 6 68
I could not build boost code, 10 94
Syntax Error 2 77
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question