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

Re: Abstract Classes

by chromatic (Archbishop)
on Apr 28, 2003 at 15:50 UTC ( [id://253725]=note: print w/replies, xml ) Need Help??


in reply to Abstract Classes

a principal point of an abstract class is that we don't care how subclasses are implemented, provided methods x, y, and z exist

Sure you do; you're forcing them to inherit from an abstract base class and to declare the existence of their methods at compile-time. That's two implementation details that your approach enforces.

Whether that's good or bad, you tell me. :)

One feature that could save a lot of cut and pasted code is support for mixins in the descendant classes. If there's no inheritance of implementation, there really ought to be another way to reuse similar code.

Replies are listed 'Best First'.
Re: Re: Abstract Classes
by hardburn (Abbot) on Apr 28, 2003 at 16:04 UTC

    Good, because without specifying the methods to implement, why have an abstract class?

    My point was that inheriting and checking the existance and signatures (if possible, which doesn't appear to be the case in Perl5) should be the only things abstract classes force on subclasses. Sorry if I wasn't clear.

    ----
    I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
    -- Schemer

    Note: All code is untested, unless otherwise stated

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://253725]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2024-04-25 22:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found