English 中文(简体)
进出/从儿童班级起基地的职能
原标题:Access/Call BaseClass Function from Child Class

Java 我有一个儿童物体,继承基质。 我正试图从一个儿童物体内传出一个基级功能,但我正在发现一个错误,说这一功能不存在。

www.un.org/Depts/DGACM/index_spanish.htm 您能告诉我,我如何从儿童班级中讲基班功能?

  function BaseClass()
  {
     this.render = function()
     {
        alert("BaseClass::render()");
     }
  }

  function ChildClass()
  {
     this.render = function()
     {
        alert("BaseClass::render()");

        // Now to CALL the base class render() function
        this.baseRender = BaseClass.prototype.render;
        this.baseRender(); // I get the error: "The function this.BaseRender() does not exist"
     }
  }

  ChildClass.prototype             = new BaseClass();    // inherit from BaseClass
  ChildClass.prototype.constructor = ChildClass;         // put the correct constructor reference back (not essential)
最佳回答

EDIT: OK,要么看上去你法典的两条字,要么在我开始写我的职务之后,你做了迅速的编辑。

http://www.un.org。

另外,<代码>(<>trender(>>>)法()目前不是其原型的一部分,而是指定给以new BaseClass(创建的每一种情况。 哪一种意思是BaseClass.prototype.render

<>(在指定<条码>与试图打电话<条码>时,请将案件从低级改为“b”。 BaseRender(,但我认为这或许只是一个打字。

我认为,最简单的改变是:

function BaseClass()
{
   // instance init here
}

BaseClass.prototype.render = function() {
   alert("BaseClass::render()");
}

并且记住, Java的“阶级”确实如此。

问题回答

暂无回答




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签