Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8046947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:57:11+00:00 2026-06-05T05:57:11+00:00

In my project I have a parent class CWnd which is the base win32

  • 0

In my project I have a parent class CWnd which is the base win32 window for classes down the chain. I then create instances of this class with a template declaration so that I can have many different types of windows.

I then add members like so:

void CChildWndClass::OnSize(HWND hWnd, UINT state, int nWidth, int nHeight)
{
    // do something
}

The problem is that these members are virtual. In some events (ie: OnDestroy) there is code that I would like to execute in every window class regardless without having to copy paste into each child class because it overrides the parents original code.

How can I have the functions in the children classes append their code to themselves, rather than override?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T05:57:13+00:00Added an answer on June 5, 2026 at 5:57 am

    Subclass into a class with the functionality you desire, and then subclass from that class of your own to obtain similar subclasses.

    The method you don’t want to implement, simply don’t, and they continue to be virtual in the subsubclasses.

    People also use to make libraries in those situations.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my c# project, I have two abstract generic parent classes which then have
I have parent project parent, which has three modules like: <groupId>com.dummy.bla.bla</groupId> <artifactId>parent</artifactId> <version>1.0-SNAPSHOT</version> <packaging>pom</packaging>
I have this project structure where I have a parent pom which include let's
Currently, I have a Maven project which inherits from a parent pom defining two
I have defined classes: public class Parent : IParent { public string ParentText {
I have a parent project that is branched to many dependent child projects. I
I have two projects: Parent project: A, Sub project: B A/pom.xml: <groupId>com.dummy.bla</groupId> <artifactId>parent</artifactId> <version>0.1-SNAPSHOT</version>
I have this maven multi-project configuration with a parent project and three child projects:
We have a sub-project 'commonUtils' that has many generic code-snippets used across the parent
I have a Maven multi-module project and I need two different parent POMs in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.