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

  • SEARCH
  • Home
  • 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 5980665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:50:00+00:00 2026-05-22T21:50:00+00:00

In C++/CLI, I want a class hierarchy similar to the following: Foo FooA :

  • 0

In C++/CLI, I want a class hierarchy similar to the following:

Foo
  FooA : Foo, ClrClassA
  FooB : Foo, ClrClassB

Is it possible for FooA to share a (non CLR) base class while also inheriting from separate CLR classes? If not, what would be the best way for FooA and FooB to share common code?

  • 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-05-22T21:50:01+00:00Added an answer on May 22, 2026 at 9:50 pm

    Generally speaking, composition is often better than inheritance as it tends to lead to less tightly coupled designs.

    If you’re mixing managed and unmanaged code, it’s generally easier in my experience to wrap unmanaged code in managed code rather than visa versa.

    Multiple inheritance isn’t supported for managed code and there’s an article on Wikipedia which explains why:

    Managed C++ and the use of classes and class based objects remains prevalent like in Visual C++. The only major change to this in Managed C++ is that the capabilities of multiple inheritance are not supported. This is because of a limitation of the CLR. A class managed under the CLR’s garbage collector cannot inherit more than one class

    It’s difficult to give a good answer as to how best to combine your classes / functionality without knowing why you want to combine the classes…

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

Sidebar

Related Questions

I want to port the following code from c# to c++/cli: class MyClass :
I want to know what exactly is the difference between CLR & CLI? From
I have a library written in C++/CLI and I want to open it up.
I have a php script that is running in CLI and I want to
I want to make a C# program that can be run as a CLI
As a simple example, I want to write a CLI script which can print
In C++/CLI , you can use native types in a managed class by it
Want to verify that my understanding of how this works. Have a C++ Class
I've got a WPF RenderTargetBitmap in C++/CLI and I want to be able to
I want to use the pythons argparse module to parse my cli parameter string.

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.