Re: Abstract interfaces and classes - Urgent Help



please post the actual code you're trying to compile, because this definately isn't it at all...

- first interfaces are abstract anyway, so you can't use the abstract keyword on them
- your casing in both keywords and interface naming differs


most probably the
"public class InterfaceClass"

is actually declared as
"private/protected/internal class InterfaceClass"

which means they're not allowing access from other classes/assemblies.

Wiebe



Carlos Lozano wrote:
Hi,

I have an OCX I need to use in an implementation and always gets a protection level error saying:
I get an error message saying:
OCXReference.InterfaceClass is inaccessible due to its protection level


The OCX module has basically the following structure:

Namespace OCXmodule
{
      public abstract interface Interface_A : _Interface_B, Interface_C
      {
      }

public abstract Interface _Interface_B
{
public abstract new void method1();
}
public abstract interface _Interface_C
{
public abstract new void method2();
public abstract new void method3();
}
public class InterfaceClass
{
public virtual new void Method2()
{
}
public virtual new void method3()
{
}
} }


I am trying to create an instance of InterfaceClass Class to use the base code.

I tried the following 2 approaches:

Attempt 1:
using System;
using OCXReference;

NameSpace MySpace
{
Public class _MyClass : OCXReference.InterfaceClass
{ public void Method2()
{
base.Method2();
}
public void method3()
{
base.Method3();
} }
}


I get an error message saying:
OCXReference.InterfaceClass is inaccessible due to its protection level

Attempt 2:
using System;
using OCXReference;

NameSpace MySpace
{
Public class _MyClass : OCXReference.Interface_A
{
private OCXReference.InterfaceClass oClass = new CXReference.InterfaceClass();


         public void Method1()
        {
            oClass.Method2();
        }

public void Method2()
{
oClass.Method2();
}
public void method3()
{
oClass.Method3();
} }
}


I get same error message when creating the new CXReference.InterfaceClass()
 saying:
OCXReference.InterfaceClass is inaccessible due to its protection level

How can I call the code contained in the Class to use the base code?

I will appreciate any help.

Carlos Lozano
www.caxonline.net
.



Relevant Pages

  • whats the point of an interface?
    ... // no access modifiers, methods are public ... void Write; ... public class Document: IStorable ... what is gained by even using the interface? ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: How to hide an interface in C#
    ... public class A, IMyInterface ... void IMyInterface.MafonctionTresPrivee ... reference to the interface). ... > internal Interface ImyInterface ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: graph of behavior - was Re: State vs. Data (was Re: Fans of Template Method with protected varia
    ... > public void f ... > interface IB ... > public class B implements a.IB ... in the client of the implementations of C i.e. package B so A must ...
    (comp.object)
  • Re: Types vs. Attributes
    ... This gets around using a placeholder interface for this... ... > use an empty interface: ... > public class ClassA: IMyInterface ... > void DumpTypes ...
    (microsoft.public.dotnet.framework)
  • Problem getting events from C# to VJ++
    ... interface IWeatherEvents: IUnknown ... public delegate void WeatherChangedDelegate(int nTemperature); ... // float Temperature ... private float m_fTemperature = 0; ...
    (microsoft.public.dotnet.languages.csharp)