Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Not every hierarchy is a tree as you mention. This can be solved in several ways:

  1. C++ and other languages (Perl among them) offer multiple inheritance, this means that a class can have multiple base classes. If you start drawing diagrams, you'll notice this can get quite nasty (or at least very tricky) if one exagerates.
  2. Java offers interfaces: one can view this as a kind of contract. Certain functions must be implemented in the class that is to adhere to the interface. This can be done in OO languages that don't support multiple inheritance, but also in C++.
The approach using interfaces has the advantage that one can "attach" properties to a tree. A person could implement the trainspotter interface and offer the method seenWhatTrainsToday().

The issue has been discussed recently in this node, but you might also be interested in the following book:

@book{Lau01,
  author =       {Y.-T.\ Lau},
  title =        {The art of objects: object-oriented design and architecture},
  publisher =    {Addison-Wesley},
  year =         {2001},
  series =       {Object technology series},
  address =      {Upper Saddle River, NJ}
}

Just my 2 cents, -gjb-


In reply to Re: perspective and object-disorientation by gjb
in thread perspective and object-disorientation by Ctrl-z

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (3)
As of 2024-04-19 20:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found