468,738 Members | 1,728 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,738 developers. It's quick & easy.

Abstract interfaces and classes - Urgent Help

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
Nov 17 '05 #1
2 1685
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

Nov 17 '05 #2
Hi Wiebe,

I have already resolved the problem. You may want to refer to the following
thread for more details.

Microsoft Community Notification - Re: Creating a COM object
http://msdn.microsoft.com/newsgroups...1-bf6a72c7116e

Thank you,

Carlos Lozano
www.caxonline.net
"Wiebe Tijsma" wrote:
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

Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Vishal Gandhi | last post: by
12 posts views Thread by Daedalus.OS | last post: by
18 posts views Thread by Bradley | last post: by
9 posts views Thread by Sean Kirkpatrick | last post: by
6 posts views Thread by Steve | last post: by
7 posts views Thread by jason | last post: by
6 posts views Thread by Miguel Guedes | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
xarzu
2 posts views Thread by xarzu | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.