One thing I want to point out. Generally, inheritance is used for "ISA" relationships (which is why Perl uses the "@ISA" array to declare inheritance). Where type A "IS A" type B. In your case, you sound like you want to say Family IS A Private which IS A Car. But that doesn't make sense: families are not cars! Families have cars, but are not cars themselves.

Perhaps you meant that it was a FamilyCar. Or a Car::Family. Those would both say you're dealing with a specific type of car - the family car. (More commonly known as a sedan, I think). Names of your packages are important. They form part of your code-as-documentation. If you had the above code working the way you wanted, and then 12 months from now you came back as an OOP guru to fix something, you'd probably be confused. While that is normal when going from beginner to advanced, I'm hoping you can learn how important names are at the same time as you're learning the implementation details of OOP in Perl. This concept, however, is not Perl-specific. It applies no matter what language you're doing OOP in. Or procedural programming. Or functional programming. Names are always important.


In reply to Re: Stuck on packages by Tanktalus
in thread Stuck on packages by Yoda_Oz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.