Marshall 通过引用从类继承
我遇到了多重继承和 MarshallByRefObj 的问题
我遇到的问题是我需要从抽象类继承并且 MarshallByRefObj
抽象类(精简):
public abstract class Drawable : IDrawable
{
//... Several unimportant methods...
public IEnumerable<ICard> Shuffle (IEnumerable<ICard>)
{
//...shuffle the cards here...
}
}
我正在尝试创建的类,需要通过通过wcf引用 显然,脱光了……:
public class Deck : Drawable, MarshallByRefObject
{
//... public stuff that implements a deck to include
// search/draw/discard functions...
}
I've got a problem with multiple inheritance and MarshallByRefObj
The problem i have is that I need to inherit from an abstract class AND MarshallByRefObj
The abstract class (stripped down) :
public abstract class Drawable : IDrawable
{
//... Several unimportant methods...
public IEnumerable<ICard> Shuffle (IEnumerable<ICard>)
{
//...shuffle the cards here...
}
}
The class I'm trying to make, which needs to be accessed by reference through wcf
Stripped down, obviously...:
public class Deck : Drawable, MarshallByRefObject
{
//... public stuff that implements a deck to include
// search/draw/discard functions...
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试从 MarshalByRefObject 派生,并实现其他类的接口。然后,定义该类类型的成员,并使您的接口只是对其的代理调用。这很痛苦,但很简单。
Try deriving from MarshalByRefObject, and implementing the interface of the other class. Then, define a member of that class' type and make your interface just proxy calls to it. It's a pain, but it's straightforward.