Subclassing, Inheritance, RE subclass "constructor" and inherited members

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • vbgunz

    Subclassing, Inheritance, RE subclass "constructor" and inherited members

    // Referring to JavaScript the Definitive Guide: 9.5 through 9.5.2

    // the base and sub classes are perfect. the following code
    // is an example case, regarding WHY delete base members from
    // a subclass AND what is wrong with the loop ONLY
    // returning -prototype :/

    // Ex 01:
    print(subInstan ce.hasOwnProper ty("baseMember" )); // false
    for (var p in SubClass){
    print(p);
    } // prototype


    // Ex 02:
    delete SubClass.protot ype.baseMember; // not customizing, delete?
    print(subInstan ce.hasOwnProper ty("baseMember" )); // false
    for (var p in SubClass){
    print(p);
    } // prototype

    // Why delete the members in subclass if I inherit them from
    // baseclass? is it the same reason you might want to put constants
    // & methods in the prototype? Is it to avoid duplication and memory
    // hogging? e.g., I don't actually need to override the base members
    // so should I really delete them from subclass?

    // Why iterating over the properties in the subclass yield ONLY ->
    // prototype? shouldn't I at least get all properties back defined in
    // ALL classes (Ex 01) AND after deleting those inherited from base on
    // sub, shouldn't I at least get those properties of sub (Ex 02)? Both
    // Examples, have several members!

  • FAQEditor

    #2
    Re: Subclassing, Inheritance, RE subclass "construct or" and inheritedmember s

    Thomas 'PointedEars' Lahn said the following on 8/28/2007 5:27 PM:
    vbgunz wrote:
    >// Referring to JavaScript the Definitive Guide: 9.5 through 9.5.2
    >
    Argh! Shall we not remove that recommendation from the FAQ already?
    If you give me a better viable alternative I will be glad to change it.

    --
    Randy
    comp.lang.javas cript FAQ - http://jibbering.com/faq/index.html
    FAQ Notes: http://www.jibbering.com/faq/faq_notes/faq_notes.html
    ECMAScript Language Specification via FAQ2.6

    Comment

    • Dr J R Stockton

      #3
      Re: Subclassing, Inheritance, RE subclass "construct or" and inherited members

      In comp.lang.javas cript message <h5SdnfzVdqWTnU jb4p2dnAA@gigan ews.com>,
      Wed, 29 Aug 2007 01:12:09, Randy Webb <HikksNotAtHome @aol.composted:
      The last time that section came up it was pointed out that if the FAQ
      >doesn't list a book then people will post a kazillion times asking
      >"What book....." because there isn't one in the FAQ. That said, I do
      >agree with the assertion that the entry should be expanded to explain
      >that it isn't a "flawless" book but that it is the "least flawless" of
      >the books available.

      So : you are the FAQ maintainer, and you should therefore expand it.

      If you can bring yourself to update the published version of the FAQ
      whenever you have new material, rather than waiting an indefinite time
      to produce a highly-polished version, then there's no problem with the
      content. Just make a significant change to the section (preferably just
      before Bart posts it), and with "Altered YYYY-MM-DD", and, as you
      yourself have recognised, you'll soon be told if you've got it wrong --
      and in enough detail for the next version to be nearly right.

      IMHO, there's not much point in recommending an out-of-print book.

      However, O'Reilly are being somewhat despicable in asking £35.50 for a
      book they sell at $49.99 - Bloomberg puts the pound at 2.021 USD at the
      moment, so £24.75 would be about right. And my IE6 won't show the ToC
      happily.

      FAQ :
      Delete the first two lines, and the 4th Edn links.
      Move the reference to the Pocket book to the bottom of 3.1.
      Now move the blog bit to the bottom.
      Change paragraph "The Fifth Edition ..." to "One of the best books is -"
      Change "By" to "by".
      Correct the spelling.
      Adjust the layout slightly to use fewer non-empty lines.

      --
      (c) John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Delphi 3? Turnpike 6.05
      <URL:http://www.merlyn.demo n.co.uk/TP/BP/Delphi/&c., FAQqy topics & links;
      <URL:http://www.bancoems.co m/CompLangPascalD elphiMisc-MiniFAQ.htmclpd mFAQ;
      <URL:http://www.borland.com/newsgroups/guide.htmlnews: borland.* Guidelines

      Comment

      • Randy Webb

        #4
        Re: Subclassing, Inheritance, RE subclass &quot;construct or&quot; and inheritedmember s

        Dr J R Stockton said the following on 8/30/2007 5:13 PM:
        In comp.lang.javas cript message <h5SdnfzVdqWTnU jb4p2dnAA@gigan ews.com>,
        Wed, 29 Aug 2007 01:12:09, Randy Webb <HikksNotAtHome @aol.composted:
        >
        >The last time that section came up it was pointed out that if the FAQ
        >doesn't list a book then people will post a kazillion times asking
        >"What book....." because there isn't one in the FAQ. That said, I do
        >agree with the assertion that the entry should be expanded to explain
        >that it isn't a "flawless" book but that it is the "least flawless" of
        >the books available.
        >
        >
        So : you are the FAQ maintainer, and you should therefore expand it.
        What is it about plain English that you can not comprehend? I won't
        waste the time to try to explain it again.

        --
        Randy
        Chance Favors The Prepared Mind
        comp.lang.javas cript FAQ - http://jibbering.com/faq/index.html
        Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/

        Comment

        • Dr J R Stockton

          #5
          Re: Subclassing, Inheritance, RE subclass &quot;construct or&quot; and inherited members

          In comp.lang.javas cript message <mMCdneZTv53N8U rb4p2dnAA@gigan ews.com>,
          Thu, 30 Aug 2007 21:20:35, Randy Webb <HikksNotAtHome @aol.composted:
          >Dr J R Stockton said the following on 8/30/2007 5:13 PM:
          >In comp.lang.javas cript message <h5SdnfzVdqWTnU jb4p2dnAA@gigan ews.com>,
          >Wed, 29 Aug 2007 01:12:09, Randy Webb <HikksNotAtHome @aol.composted:
          >>
          >>The last time that section came up it was pointed out that if the
          >>>FAQ
          >>doesn't list a book then people will post a kazillion times asking
          >>"What book....." because there isn't one in the FAQ. That said, I do
          >>agree with the assertion that the entry should be expanded to explain
          >>that it isn't a "flawless" book but that it is the "least flawless" of
          >>the books available.
          > So : you are the FAQ maintainer, and you should therefore expand
          >>it.
          >
          >What is it about plain English that you can not comprehend? I won't
          >waste the time to try to explain it again.
          You should spend your time in producing and publishing up-to-date FAQ
          releases. You would then not be tempted to waste your time in self-
          exculpatory posts.

          I cannot understand any honourable explanation for your taking on the
          maintenance of the group FAQ when you clearly have no intention of doing
          the job in the customary and effective manner.

          You should resign, or be deposed.

          You could stand for re-appointment by the group, but we now know how
          useless you are.

          --
          (c) John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v6.05 MIME.
          Web <URL:http://www.merlyn.demo n.co.uk/- FAQish topics, acronyms, & links.
          Plaintext, quoting : see <URL:http://www.usenet.org. uk/ukpost.html>
          Do not Mail News to me. Before a reply, quote with ">" or "" (SoRFC1036)

          Comment

          • Randy Webb

            #6
            Re: Subclassing, Inheritance, RE subclass &quot;construct or&quot; and inheritedmember s

            Dr J R Stockton said the following on 9/1/2007 11:17 AM:
            In comp.lang.javas cript message <mMCdneZTv53N8U rb4p2dnAA@gigan ews.com>,
            Thu, 30 Aug 2007 21:20:35, Randy Webb <HikksNotAtHome @aol.composted:
            >Dr J R Stockton said the following on 8/30/2007 5:13 PM:
            >>In comp.lang.javas cript message <h5SdnfzVdqWTnU jb4p2dnAA@gigan ews.com>,
            >>Wed, 29 Aug 2007 01:12:09, Randy Webb <HikksNotAtHome @aol.composted:
            >>>
            >>>The last time that section came up it was pointed out that if the
            >>>FAQ
            >>>doesn't list a book then people will post a kazillion times asking
            >>>"What book....." because there isn't one in the FAQ. That said, I do
            >>>agree with the assertion that the entry should be expanded to explain
            >>>that it isn't a "flawless" book but that it is the "least flawless" of
            >>>the books available.
            >> So : you are the FAQ maintainer, and you should therefore expand
            >>it.
            >What is it about plain English that you can not comprehend? I won't
            >waste the time to try to explain it again.
            I see that you ignored the question.
            You should spend your time in producing and publishing up-to-date FAQ
            releases. You would then not be tempted to waste your time in self-
            exculpatory posts.
            I will, after you answer the question.
            I cannot understand any honourable explanation for your taking on the
            maintenance of the group FAQ when you clearly have no intention of doing
            the job in the customary and effective manner.
            Of course, nothing I present to you would be considered "honorable" by
            you so there isn't much point in me wasting my time trying - yet again -
            to explain it to you. I have pointed you to the thread where I explained
            that my time was limited for a while and even why it was limited. You
            just didn't seem to be able to comprehend what you read.
            You should resign, or be deposed.
            If the group wants me to give it up, I will. Not a problem with it
            either. I have offered to you, several times, a way to "solve the
            problem" and to date you have not done anything about it but whine
            incessantly about it because you don't want to do anything *but* whine
            about it.

            --
            Randy
            Chance Favors The Prepared Mind
            comp.lang.javas cript FAQ - http://jibbering.com/faq/index.html
            Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/

            Comment

            Working...