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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:49:13+00:00 2026-05-16T05:49:13+00:00

Situation: Assembly 1 ________________________ ________________________ | Class A | | Class B | |———————–|

  • 0

Situation:

Assembly 1
________________________             ________________________
| Class A               |           | Class B               |
|-----------------------|           |-----------------------|
| Method someMethod     |---------->| Method otherMethod    |
|                       |           |                       |
|_______________________|           |_______________________|

Assembly 1 is a application that other developers can use.
We will give them only the .dll so we can publish updates from the application if we don’t change the api. The developers can’t change the framework in assembly 1

Methods are virtual so developers can override methods to implement there own logic if needed.

The problem is that a developer can’t override otherMethod from class B,
he can override it but Class A will always call the method from Class B and not the overridden method.

Assembly 1
________________________             ________________________
| Class A               |           | Class B               |
|-----------------------|           |-----------------------|
| Method someMethod     |----XX---->| Method otherMethod    |
|                       |           |                       |
|_______________________|           |_______________________|
                \                                    |
                 \                                   |
                  \                                  |
Assembly 2         \                                 |
                    \                ________________|_______
                     \               | Class ExtendedB       |
                      \              |-----------------------|
                       \____________>| Method otherMethod    |
                                     |                       |
                                     |_______________________|

Assembly 2 haves a reference to assembly 1

Partial class doesn’t work because it must be the same assembly and will not work over 2

Are there design patterns for this problem ?
Or is there a other solution with reflection or something ?

EDIT Added a code example:

/* ASSEMBLY 1 */

namespace Assembly1
{
    public interface IAService
    {
        void TestMethod3();
        void TestMethod4();
    }

    public interface IBService
    {
        void TestMethod1();
        void TestMethod2();
    }

    public class AService : IAService
    {
        // Base implementation of AService
        public  virtual void TestMethod3()
        {
            //do something
        }
        public virtual void TestMethod4()
        {
            //do something
        }
    }

    public class BService : IBService
    {
        // Base implementation of BService
        public virtual void TestMethod1()
        {
            //do something
        }
        public virtual void TestMethod2()
        {
            //need to call AService implementation from assembly 2
        }
    }
}   





/* ASSEMBLY 2 */
namespace Assembly2
{
    public class NewAService : AService
    {
        public override void TestMethod3()
        {
            //default implementation which could be overridden
            base.TestMethod3();
        }

        public override void TestMethod4()
        {
            //default implementation which could be overridden
            //An implementation of IBService Should be called

            base.TestMethod4();
        }
    }
}
  • 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-16T05:49:14+00:00Added an answer on May 16, 2026 at 5:49 am

    you should refactor

    public interface IClassB
    {
       void SomeMethod();
    }
    public Class A
    {
        private IClassB myInstanceB = new ClassB();
    
        public ClassA(){}
    
        public ClassA(IClass B)
        {
          myInstanceB = B;
        }
    
        public void SomeMethod()
        {
            myInstanceB.SomeMethod();
        }
    }
    
    public ClassB : IClassB
    {
       public void SomeMethod()
       {
          // some wicked code here...
       }
    }
    

    with this refactoring done, developers can use the default implementation by using the empty constructor. if they need some other logic than they just have to implement the interface IClassB and just pass it in the other constructor.

    the usage in assembly 2 would be something like this

    public class NewFunctionalityClass : IClassB
    {
        public void SomeMethod()
        {
           //something else
        }
    }
    public TestClass()
    {
       public void ShowMethod()
       {
          var defaultObject = new ClassA();
          defaultObject.SomeMethod();  // default implementation
    
         var otherObject = new ClassA(new NewFunctionalityClass());
         otherObject.SomeMethod(); // here the new implementation will run
       }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 512k
  • Answers 512k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You could use some sort of support ticketing / FAQ… May 16, 2026 at 5:44 pm
  • Editorial Team
    Editorial Team added an answer If I'm reading your question right, it looks like you… May 16, 2026 at 5:44 pm
  • Editorial Team
    Editorial Team added an answer If you can, pass the event object to these functions,… May 16, 2026 at 5:44 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have the following situation. There is some very common class in my application
Situation: I want to show the method and line number for the code that
The situation: I have a class library, called RT.Servers , containing a few resources
If I have a class declared in assembly A, and am listening to it
I've got a situation where I need to generate a class with a large
Here's the scenario: Platform: VS2005 and language is VC++ Situation: There's just 1 assembly
Following situation: Parent: namespace Base; /** @Entity @Table(name=section) */ class Section extends Skeleton {
Here's the situation: I'm attempting to get a collection of all types in my
I have an abstract generic class BLL<T> where T : BusinessObject . I need
Considering a hypothetical situation where an old, legacy presentation library has been maintained over

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.