spencerde

Hi all,

I'm developing a Framework type application for internal use. I have a base class FrameworkClassA in my Framework from which I derive another class in my Framework called FrameworkClassB. Users of this Framework are expected to derive some of their classes from FrameworkClassA as well. But there are some "worker" functions/properties in FrameworkClassA that I would prefer the users not see ( If they see it they will try to use it). These "worker" functions are required by my FrameworkClassB though. Is there a way to let the users derive a class from FrameworkA without exposing all of the methods. This project is well underway but I have the option of changing the user code that uses this Framework.

Appreciate any advice,

Dave



Re: Visual C# General How to make methods private to some derived classes but not others?

Kent Boogaart

Hi Dave,

You can use internal members. They will be visible only to types in the same assembly in which they're declared (or any friend assemblies by way of the InternalsVisibleToAttribute).

HTH,
Kent




Re: Visual C# General How to make methods private to some derived classes but not others?

spencerde

Thanks Kent,

That's exactly what I needed. I was afraid I was going to have to rewrite a lot of code.

Thanks a million!

Dave