Jump to content

antony12

Members
  • Posts

    10
  • Joined

  • Last visited

Posts posted by antony12

  1. Hello and welcome!

    So, I recently finished a fairly lengthy programme on inheritance. I was instructed to provide a function toString() { [native code] } function in each class. The issue is that I have methods like getArea and getPerimeter in my subclasses. In my function toString() { [native code] } function for this class, I want function toString() { [native code] } to execute and, for example, output the region of the object that function toString() { [native code] } is invoked on. I just don't understand the syntax... I assumed it would be:

    "Area : " + this.getArea()

    However, it returns an error. So, in my function toString() { [native code] } class, how would I refer to this *unknown* object?

    Thank you very much!

×
×
  • Create New...