Well, from the definition, an ABC (or ABP in our case..) is a class / pkg
which you must inherit from and override the its methods in the subclassed /
sub-pkg.
So I will not create instances of it nor call its subs directly, I will use
it as a design skelton, it will include some real stuff (in the shape of a
blessed hash ref), which will be used in the derived pkg's.
In C++ for instance (CIAdapter an ABC):
class CIAdapter {
private:
.....
public:
virtual void decodeMsg() = 0;
*...*
};
class C3Com : public CAdapter {
private:
.....
public:
void decodeMsg() { /* implementation */};
*...*
};
On Fri, Aug 12, 2011 at 7:11 AM, Gabor Szabo <[email protected]> wrote:
> If you are asking, I would be interested to know what does
> an Abstract Base Class give if every method of it throws an exception?
>
>
> Gabor
>
>
> On Fri, Aug 12, 2011 at 2:01 AM, Natty <[email protected]> wrote:
> > Or should I call it ABP? (Abstract Base Package (-:)
> > Anyway , I was wondering what is the best approach to create Abstract
> Base
> > Classes in Perl?
> > I know I can just create a package FOO, squeeze in some methods (subs..)
> > with empty bodies and then override them in any pkg that sub-classes
> (with
> > @ISA, use parent,etc..) it...
> > But I bet there is a better, cleaner way to do this, maybe with Moose(?)?
> > Thanks,
> _______________________________________________
> Perl mailing list
> [email protected]
> http://mail.perl.org.il/mailman/listinfo/perl
>
_______________________________________________
Perl mailing list
[email protected]
http://mail.perl.org.il/mailman/listinfo/perl