473,587 Members | 2,479 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error with "internal interface"

I am facing a problem. My project is composed of several assemblies. In one
of them -the backend- I have several internal classes that must implement an
interface. These internal classes are only used by one master class that is
public.

I am able to declare the interface as "internal interface" without problem
but when I attempt to use it by declaring a class that implements it, if I
declare the implemented interface members as "internal" (they are supposed
to be seen only within the assemly) I get an error that it is not
implemented because of "wrong return type or wrong visibility" so basically
it is forcing me to use "public" which I don't want because I don't want
those methods to be seen outside.

Or... perhaps the public gets "downgraded " if you use an "internal"
attribute in the class declaration, at least that is what I am hoping for
but makes the notation a bit confusing.

Emilio
Jun 14 '07 #1
4 2393
On Jun 14, 1:39 pm, "~~~ .NET Ed ~~~" <tiredofs...@ab olishspam.now>
wrote:
I am facing a problem. My project is composed of several assemblies. In one
of them -the backend- I have several internal classes that must implement an
interface. These internal classes are only used by one master class that is
public.

I am able to declare the interface as "internal interface" without problem
but when I attempt to use it by declaring a class that implements it, if I
declare the implemented interface members as "internal" (they are supposed
to be seen only within the assemly) I get an error that it is not
implemented because of "wrong return type or wrong visibility" so basically
it is forcing me to use "public" which I don't want because I don't want
those methods to be seen outside.
That's because all interface members are public by default.
Or... perhaps the public gets "downgraded " if you use an "internal"
attribute in the class declaration, at least that is what I am hoping for
but makes the notation a bit confusing.
Nope, the members are still public.

However, if the class itself is internal, that's pretty much
irrelevant as no-one outside the assembly will be able to see it
anyway.

Jon

Jun 14 '07 #2
Hi,

If those classes are only used by one class, why don't you declare them as
private to the master class?

/In the same vein you can declare your interface inside the Master class.
But even so it might be visible from the outside using Master.Interfac e

Now, if you change the interface for an abstract class inside the Master you
can get what you want:
public class Master
{
abstract class A
{
abstract public void Me();

}
class B : A
{
public override void Me()
{
throw new Exception("The method or operation is not
implemented.");
}
}
}

"~~~ .NET Ed ~~~" <ti*********@ab olishspam.nowwr ote in message
news:ua******** ******@TK2MSFTN GP04.phx.gbl...
>I am facing a problem. My project is composed of several assemblies. In one
of them -the backend- I have several internal classes that must implement
an interface. These internal classes are only used by one master class that
is public.

I am able to declare the interface as "internal interface" without problem
but when I attempt to use it by declaring a class that implements it, if I
declare the implemented interface members as "internal" (they are supposed
to be seen only within the assemly) I get an error that it is not
implemented because of "wrong return type or wrong visibility" so
basically it is forcing me to use "public" which I don't want because I
don't want those methods to be seen outside.

Or... perhaps the public gets "downgraded " if you use an "internal"
attribute in the class declaration, at least that is what I am hoping for
but makes the notation a bit confusing.

Emilio

Jun 14 '07 #3
"~~~ .NET Ed ~~~" <ti*********@ab olishspam.nowsc hrieb im Newsbeitrag
news:ua******** ******@TK2MSFTN GP04.phx.gbl...
I am able to declare the interface as "internal interface" without problem
but when I attempt to use it by declaring a class that implements it, if I
declare the implemented interface members as "internal" (they are supposed
to be seen only within the assemly) I get an error that it is not
implemented because of "wrong return type or wrong visibility" so
basically it is forcing me to use "public" which I don't want because I
don't want those methods to be seen outside.
If you want the methods to remain internal you have to implement them
explicitly, that is by naming the interface in the member:

public class Class : Interface
{
//This member is only accessible by cast to the interface
void Interface.Metho d()
{
//This call is made if the following declaration is present
Method();
//Or simpöy put here the implementation
}

//Make it accessible without cast to interface
internal void Method()
{
...
}
}

Now you have a public class wich implements a interface, wich is only
accessible internal.

But if the class itself is internal, all members even public will only be
accessible internal.

Christof
Jun 14 '07 #4
>I am able to declare the interface as "internal interface" without
>problem
but when I attempt to use it by declaring a class that implements it, if
I
declare the implemented interface members as "internal" (they are
supposed
to be seen only within the assemly) I get an error that it is not
implemented because of "wrong return type or wrong visibility" so
basically
it is forcing me to use "public" which I don't want because I don't want
those methods to be seen outside.

That's because all interface members are public by default.
>Or... perhaps the public gets "downgraded " if you use an "internal"
attribute in the class declaration, at least that is what I am hoping for
but makes the notation a bit confusing.

Nope, the members are still public.

Didn't we just discuss this exact issue to death earlier this week?

http://groups.google.com/group/micro...56d1646a1e150b

Jun 15 '07 #5

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

Similar topics

5
3007
by: Sam | last post by:
Guys facing a strange problem any clue would really rescue me.. i am using a ASP application with following things Server : Intel Xeon (TM) CPU 2GHz, 2GB RAM, 136GB HDD OS : Windows 2000 Advanced server. IIS5.0 Database: Oracle (Using ADODB to connect to the Database) App server running on the same machine (COM+)
7
3331
by: Will Hartung | last post by:
I have this: <a class="pink_link" href="faq.html#q1">Go to question 1</a> And the CSS is simply: ..pink_link {color: #fa61b7; font-weight: bold;} So, I'm curious why my links are blue and not pink. All of my other "pink_links" are pink, but they don't link to anchors on the same page.
5
3421
by: BoonHead, The Lost Philosopher | last post by:
Does anyone know how to implement internal interface documentation for functions and parameters? I found a similair thing for proerties. For properties I found something like: <System.ComponentModal.Description("This property sets aars!")> Property Aars() As Boolean '...Property body... End Property
12
3082
by: relaxedrob | last post by:
Hi All! I have a page with with the following style information: <link rel="stylesheet" type="text/css" href="/eEmployment/eTech.css" /> <style type="text/css"> DIV.Application { BACKGROUND-IMAGE:url(/someImage.jpg); }
1
13630
by: n_o_s_p_a__m | last post by:
My web service has a webmethod whose return type is declared as an interface type, for example: public IBusinessProcess GetBusinessProcess() {} which generates the lovely error: Cannot serialize interface IBusinessProcess
2
1630
by: Peter Rilling | last post by:
I have some COM+ components that seem to be throwing some exceptions. However, IIS to just displays the "insernal server error" message. How can I get the actual error to display?
2
2472
by: Gnus | last post by:
Hi all! I have a little(?) problem with external schema location... I'm using xerces/xalan (C++) for doing some actions with some set of xml-files. Some of these files must validating against schema, which location specify in config file ("external" schema). Other files must be validating against schema, which location specify in parsed xml file (via xsi:shemaLocation attribute, "internal" schema) How can I switch between these ...
23
24525
by: ticfranca | last post by:
Hi, I'm getting this error in the code below: sub Pega_recorde { $database = 'bundinha'; $host = 'localhost'; $usuario = 'myhumoradm'; $senha = 'my8xr2d2'; $dbh=DBI->connect("DBI:mysql:database=$database;host=$host","$usuario","$senha") or die "Can't open DB: $!";
0
1363
by: Peter | last post by:
Hi I'm stuck and would appreciate some help. I have created a Class library project that contains a number of interface definitions that must be used by a range of other VB.NET applications. One of the interfaces has been defined as follows: Public Interface IPlugin
0
7923
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8216
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
7974
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6629
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5719
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3845
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3882
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2364
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1455
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.