473,387 Members | 1,313 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to hide base class in assembly?

Hi,

I'm trying to develop a control and want to hide the base class of the
control, how do i do that?

I want to do something like the follow :-
internal class BaseClass {
}

public class SubClass : BaseClass {
}

but i get an Inconsistent accessibility error.
Nov 17 '05 #1
3 4762
Hi,

you can't hide a baseclass that way.
The baseclass of a class must be as accessible as the class itself.
So all code that can access a class also con access it's baseclasses.

But you could hide the members of the class.

Christof

"mfc_mobile" <mf********@newsgroup.nospam> schrieb im Newsbeitrag
news:O7**************@tk2msftngp13.phx.gbl...
Hi,

I'm trying to develop a control and want to hide the base class of the
control, how do i do that?

I want to do something like the follow :-
internal class BaseClass {
}

public class SubClass : BaseClass {
}

but i get an Inconsistent accessibility error.

Nov 17 '05 #2
You could cheat and write a wrapper to provide a facade for the class such
as:

internal class baseclass
{
public void basemethod()
}

internal class derivedclass : baseclass
{
public void anothermethod;
}

public SeenClass
{
derivedclass dc=new derivedclass();

public basemethod()
{
dc.basemethod();
}

public void anothermethod()
{
dc.anothermethod();
}
}

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"mfc_mobile" <mf********@newsgroup.nospam> wrote in message
news:O7**************@tk2msftngp13.phx.gbl...
Hi,

I'm trying to develop a control and want to hide the base class of the
control, how do i do that?

I want to do something like the follow :-
internal class BaseClass {
}

public class SubClass : BaseClass {
}

but i get an Inconsistent accessibility error.

Nov 17 '05 #3
You cannot hide the base class but you can make it impossible for anyone
else to create instances from it if you make its constructor protected.
"mfc_mobile" <mf********@newsgroup.nospam> schrieb im Newsbeitrag
news:O7**************@tk2msftngp13.phx.gbl...
Hi,

I'm trying to develop a control and want to hide the base class of the
control, how do i do that?

I want to do something like the follow :-
internal class BaseClass {
}

public class SubClass : BaseClass {
}

but i get an Inconsistent accessibility error.

Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: keith | last post by:
I created a custom control class which inherted from another control class in C#. The another control referenced another assembly. I put the custom control into toolbox and drew it into a form...
10
by: Ray Z | last post by:
hi, there I build a Class Library, I write a class A to implement interface IA. The problem is when I give the dll file to others, thet can get all information about not only IA, but also A. They...
4
by: C-Sharper or C-Hasher, one of the two | last post by:
Hi, I have a C# class libary (Class1) which is inherited by another class in a Windows Forms app. I want this other class to implement some, but not all of the features of the base class. How...
6
by: Alex Sedow | last post by:
Example 1 interface I { string ToString(); } public class C : I { public void f() {
12
by: Chris | last post by:
Hi I am trying to create a base class with the Protected keyword Protected MustInherit Class MyBaseClas .. .. End Clas And I got an error saying something like the Protected keyword...
9
by: Martin Widmer | last post by:
Hello! I would like to hide one property of a base class in a derived class. How could it be done? I tried to override it with a private property, but that doesn't seem to do the hiding. ...
8
by: Brett Romero | last post by:
I have this situation: myEXE <needs< DerivedClass <which needs< BaseClass Meaning, myEXE is using a type defined in DerivedClass, which inherits from BaseClass. I include a reference to...
6
by: --== Alain ==-- | last post by:
Hi, I derived a control to create my custom control. However, some of the control base properties are useless from my point of view and i would like to avoid control user to change them. How...
2
by: dolphin | last post by:
Hi everyone . I am confused about the different between override overload and hide. May be I have a wrong opinion, I always think that hide is very similar with override. Both of them call the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.