[英]Marshall By Reference Inherit from class
我有多重繼承和MarshallByRefObj的問題
我遇到的問題是我需要從一個抽象類AND 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...
}
嘗試從MarshalByRefObject派生,並實現其他類的接口。 然后,定義該類的類型的成員,並使您的接口只是代理調用它。 這是一種痛苦,但它很簡單。
public class Deck : MarshalByRefObject, IDrawable
{
Drawable _drawable = new Drawable(...);
// Implement IDrawable
void IDrawable.Foo() { _drawable.Foo(); }
void IDrawable.Bar() { _drawable.Bar(); }
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.