无法从w/cscript访问继承的属性(P1).
类结构看起来像这样:
[ComVisible]
public interface IA
{
string P1{get;}
}
[ComVisible]
public interface IB : IA
{
string P2{get;}
}
[ComVisible]
public abstract class Base : IA
{
public string P1{get{return "somestring";}}
}
[ComVisible]
public class Concrete : Base, IB
{
public string P2{get{return "P2somestring";}}
}
Run Code Online (Sandbox Code Playgroud)
js文件中的客户端代码:
try{
var obj = new ActiveXObject("Concrete");
WshShell.Popup(obj.P1); //<-- displays empty string
}catch(e)
{
WshShell.Popup(e.description);
}
Run Code Online (Sandbox Code Playgroud)
如果我将属性P1添加到接口IB,一切正常,但那么继承点是什么呢?或者我在这里做错了什么?