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 8621131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:45:01+00:00 2026-06-12T06:45:01+00:00

Are there any downsides to changing the class hierarchy of a class that has

  • 0

Are there any downsides to changing the class hierarchy of a class that has been in the software for a very long time (10+ years) and that is used extensively?
I have a class A, that doesn’t inherit from anything. What I’d like to do is make it inherit from a new abstract base class, and change 2 of its current methods to virtual methods.
I would usually go for it but my coworkers are much more reluctants, so what possible problems could this cause?
thanks

edit :
the reason I want to do this:

We are creating a new module that can take as “source” either the old class A or the newly created class B.
So I am thinking of creating an abstract class SourceofX who class A and B would inherit from.
The “polymorphism” would only be used by new class / method that take a SourceofX object.
If you have better ideas than this, I am all ears

  • 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-12T06:45:02+00:00Added an answer on June 12, 2026 at 6:45 am

    If you really think the new structure is better, then I would go with what Luchian Grigore says, but it isn’t the only option. For example, you can use a proxy:

    struct Base {
      virtual void doSomething() = 0;
    };
    
    void someFunction(Base &base)
    {
      ...
      base.doSomething();
      ...
    }
    
    struct NewClass : Base {
      virtual void doSomething();
    };
    
    struct OldClassProxy : Base {
      OldClassProxy(OldClass &old) : old(old) { }
    
      virtual void doSomething()
      {
        old.doSomething();
      }
    
      OldClass &old;
    };
    

    Now you can use your new function with instances of your old class without having to modify the old class:

    NewClass a;
    OldClass b;
    someFunction(a);
    OldClassProxy b_proxy(b);
    someFunction(b_proxy);
    

    If there are lots of places where you need the proxy, then you can write an overload:

    void someFunction(OldClass &old_class)
    {
      OldClassProxy proxy(old_class);
      someFunction(proxy);
    }
    

    which will let you do this:

    NewClass a;
    OldClass b;
    someFunction(a);
    someFunction(b);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Are there any downsides in Python to using a library that is just a
Are there any downsides to using a JavaScript class with this pattern? var FooClass
Quite a few apps support plugins. Are there any downsides to having a large
Is Model-View-ViewModel the best pattern to use in WPF? Are there any downsides?
Is there any way I can set a formatter on models that will convert
Are there any downsides, like perf, or debugging capability reduction if I'm shoving in
Are there any downsides with using make_shared<T>() instead of using shared_ptr<T>(new T) . Boost
Are there any downsides to passing in an Erlang record as a function argument?
Are there any downsides to prefixing my HTML documents with <!DOCTYPE html> Will it
Are there any downsides to using '?' -style character literals to compare against, or

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.