开发者

Is it possible to extend more then one abstract class?

开发者 https://www.devze.com 2023-03-19 11:53 出处:网络
Is it possible to extend more then one abstract class? I\'m trying to convert the java bytecode library in C#

Is it possible to extend more then one abstract class?

I'm trying to convert the java bytecode library in C#

I figured out in the original java bytecode library it extended 2 interfaces or in my case abstract class (because it has variables).

Doesn't seem to work in C#...

class JClassParser : JInstructions, JConstantTypes
{
}

JInstructions gets extended perfectly.. but JConstantTypes doesn't work..

of course the workaround I have to use it like this.. JConstantTypes.Variable in开发者_StackOverflow class which you are extending from


No, C# has single inheritance only.

However, you could just use Interfaces instead, since that's basically the same thing:

class JClassParser : IInstructions, IConstantTypes
{
    // implementations of the above interfaces
}
0

精彩评论

暂无评论...
验证码 换一张
取 消