我怎么能有多个基类。 [英] How can i have multiple base classes.

查看:71
本文介绍了我怎么能有多个基类。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我希望能够为我所有的主要全球

部分创建一个伞式课程,但我仍然希望保留他们都在单独的文件中

如下所示,但我一直收到一个错误,说你不被允许

多个基类。

// /< summary>


///这是一次性加载所有全局类的伞形对象。


///它应该只用于此任务。


///< / summary>


公共类myGlobal:GlobalVariables,Settings,ErrorHandler ,秒表


{

}


有没有人知道这样做的方法。


谢谢


墨水

解决方案

" iKiLL" < iK *** @ NotMyEmail.com写信息

新闻:%2 **************** @ TK2MSFTNGP02.phx.gbl ...


大家好,

我希望能够为我所有的主要全球部分创建一个伞类但我

仍然希望将它们保存在单独的文件中,如下所示,但我保持

收到错误,说明你不允许多个基类。


///< summary>


///这是用于一次加载所有全局课程的伞形对象。


///它应该只用于此任务。


///< / summary>


public class myGlobal:GlobalVariables,Settings,ErrorHandler,StopWatch

{


}



有没有人知道这样做的方法。


谢谢


墨水



..NET不支持多重继承,所以th答案是你不能从多个

基础派生出来。


Willy。


iKiLL写道:


public class myGlobal:GlobalVariables,Settings,ErrorHandler

,StopWatch

{


}



..NET / C#不支持多重继承。 Anders Hejlsberg不喜欢

:-)


有没有人知道这样做的方法。



您应该使用使用你要引用的类的指令。


Ebbe


感谢你们的评论,


Ebbe你的意思是什么(使用类的指令)这是一个简单的工作。

i找到了一个使用界面的复杂工作。


Thnaks,

ink


" Ebbe Kristensen" < eb ** @ ekologic.dkwrote in message

news:eL ************** @ TK2MSFTNGP05.phx.gbl ...
< blockquote class =post_quotes>
iKiLL写道:


> public class myGlobal:GlobalVariables,Settings,ErrorHandler
,StopWatch
{

}



.NET / C#不支持多重继承。 Anders Hejlsberg没有像这样的
:-)


>有没有人知道这样做的方法。



您应该使用使用你要引用的类的指令。


Ebbe



hi all,

I would like to be able to create an umbrella class for all my main global
sections but I would still like to keep them all in separate file something
like the below but I keep getting an error saying you are not allowed
Multiple base classes.
/// <summary>

/// This is the umbrella Object for loading all the Global classes at once.

/// It should only ever be used for this task.

/// </summary>

public class myGlobal : GlobalVariables , Settings , ErrorHandler ,StopWatch

{
}

Does any one know a way of doing this.

Thanks

ink


解决方案

"iKiLL" <iK***@NotMyEmail.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...

hi all,

I would like to be able to create an umbrella class for all my main global sections but I
would still like to keep them all in separate file something like the below but I keep
getting an error saying you are not allowed Multiple base classes.
/// <summary>

/// This is the umbrella Object for loading all the Global classes at once.

/// It should only ever be used for this task.

/// </summary>

public class myGlobal : GlobalVariables , Settings , ErrorHandler ,StopWatch

{
}

Does any one know a way of doing this.

Thanks

ink

..NET does not support Multiple Inheritance, so the answer is you can''t derive from multiple
base classes.

Willy.


iKiLL wrote:

public class myGlobal : GlobalVariables , Settings , ErrorHandler
,StopWatch
{
}

..NET/C# does not support multiple inheritance. Anders Hejlsberg doesn''t like
it :-)

Does any one know a way of doing this.

You should use "using" directives for the classes, you want to reference.

Ebbe


Thanks for your comments both of you,

Ebbe what do you mean by ("using" directives for the classes) is this a
simple work around.
i have found a complicated work around using Interfaces.

Thnaks,
ink


"Ebbe Kristensen" <eb**@ekologic.dkwrote in message
news:eL**************@TK2MSFTNGP05.phx.gbl...

iKiLL wrote:

>public class myGlobal : GlobalVariables , Settings , ErrorHandler
,StopWatch
{
}


.NET/C# does not support multiple inheritance. Anders Hejlsberg doesn''t
like it :-)

>Does any one know a way of doing this.


You should use "using" directives for the classes, you want to reference.

Ebbe



这篇关于我怎么能有多个基类。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆