不行。var v_ret_obj={};
Obj.F("test", v_ret_obj);v_ret_obj返回后属性全是undefined, 而在Obj的F方法内,是给*pps赋了值的。如下:Obj是用vc写的控件,方法F
STDMETHODIMP CCl::F(BSTR b, IDispatch **pps)
{
.....
pk->AddRef();
*pps=pk;
...
return S_OK;
}所以我需要传址调用,传值调用不行,因为我在方法内改写了参数值,并需要它返回给调用者

解决方案 »

  1.   

    你可能把概念弄混了,至少不能用c的概念来理解。
    <script>
    function obj(name,id) { //定义对象
      this.name = name;
      this.id = id;
      this.showname = function() {
        alert(this.name);
      }
    }v = new obj("aaa","p1"); //创建对象document.write(v.name+"<br>"); //查看该对象的属性
    document.write(v.id+"<br>");v.showname(); //执行该对象的方法function test(o) { //测试对象的传递
      o.showname();
    }test(v); // 测试
    </script>
      

  2.   

    js里没有继承,没有指针
    xuzuning(唠叨)的方法很好