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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:27:38+00:00 2026-06-08T09:27:38+00:00

I have a scenario where the compiler is complaining that i am missing a

  • 0

I have a scenario where the compiler is complaining that i am missing a needed reference.

I have 3 assemblies:

  • A.DLL

    • public class BaseClass
  • B.DLL (References A.DLL)

    • public class DerivedClass : BaseClass
  • C.DLL

    var derived = new DerivedClass();

In C.DLL i am only referencing B.DLL (i need access to DerivedClass only).

The compiler gives an error, saying i need to also reference A.DLL

This completely breaks the encapsulation, and i am not sure why this is needed (since B.DLL references A.DLL).

EDIT: Bad choice of words on “breaking encapsulation”. My intention was this causes what seems to be an additional compile-time constraint on this project (C.DLL) since i am only instantiating types from B.DLL, and not from A.DLL.

I would want this compile-time requirement to be removed, mostly because B and C sit in the same solution, but A does not.

  • 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-08T09:27:40+00:00Added an answer on June 8, 2026 at 9:27 am

    This completely breaks the encapsulation, and i am not sure why this is needed (since B.DLL references A.DLL).

    I don’t see how it “completely breaks the encapsulation”.

    In order to perform member resolution, the compiler needs to know what’s in BaseClass. Therefore to compile C.dll, you need references to both A.dll and B.dll. When someone is writing code accessing an instance of DerivedClass, they need to know what BaseClass supports, as it’s likely to be a super-set of what DerivedClass itself overrides.

    Even if you don’t like it, that’s just the way it is. If you don’t want A.dll to be required at compile-time you could use composition instead of inheritance – but you’ll still need A.dll at execution-time anyway.

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

Sidebar

Related Questions

I have this scenario well, i'll let the model explain. public class ScheduleMonthlyPerDayModel {
I have this following scenario namespace A { //... class A { public: static
I've come up against the unlikely scenario when I reference two external assemblies that
I have a path defined: when /the admin home\s?page/ /admin/ I have scenario that
I have a scenario that is causing a type mismatch that I cannot seem
Scenario: I have VS 2010 (C# 4 compiler) targeting 3.5 on my client machine.
I have an hierarchical structure of classes like this public class Class1 { internal
Today I ran into a scenario where I have to create a method that
Scenario I have the following two overloads that I need in order to instantiate
I have a possible implementation scenario where I need a dictionary object that will

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.