2 Replies Latest reply on Dec 20, 2007 3:37 PM by Newsgroup_User

    Multiple level inheritance

    Jim-sama Level 1
      i've got 3 cfcs: a, b, and c.

      <cfcomponent name="a">
      <cffunction name="Init" access="public" returntype="a">
      <cfreturn this />

      <cfcomponent name="b" extends="a">

      <cfcomponent name="c" extends="b">

      I then try to call:
      bobo = CreateObject("Component", "c").Init();

      But i'm getting "The value returned from the Init function is not of type a".

      Any Ideas?

      Should i have b and c override the init() method and thier version call each that one's base super or something?
        • 1. Re: Multiple level inheritance
          Jim-sama Level 1
          Yep, that was exactly what i needed to do.
          • 2. Re: Multiple level inheritance
            Level 7
            > Yep, that was exactly what i needed to do.

            No, you should not / do not need to do that.

            I think if you tested with your exact(*) test code, then it would all work
            fine. I have just tested this.

            However I reckon your sample code is just a simplification of the code you
            have erroring, and the problem is something peculiar to the rest of the
            code that you've factored out.

            Post the exact code.

            Which version of CF are you running?


            (*) Allowing for correcting the typos (your closing </cfcompnonent> (sic)
            tag). Also <cfcomponent> has no NAME attribute, so you should lose that.
            It doesn't generally cause problems as <cfcomponent> will allow any
            nonsense attributes, but I believe some people have had some strife when
            calling CFC instances remotely with a NAME attribute.