aidy1
(aidy)
7 July 2008 11:36
1
Hi,
Could anyone please tell me what the difference would be of inheriting
a class versus passing that class\object through the initialize
method?
class ErrorBox < Box
end
v
box ||= Box.new
class ErrorBox
def initialize(box)
end
end
And why would I do one over the other?
Thanks
Aidy
Chris6
(Chris)
7 July 2008 12:31
2
Try googling "inheritance vs delegation" and "inheritance vs
composition"
Here is a discusin from Perl (PerlMonks - The Monastery Gates ?
node_id=278375), looks to cover the
area pretty good
Artima has a lot of good info, here is an article on inheritence vs
composition (similar to delegation),
http://www.artima.com/designtechniques/compoinh.html
cheers
···
On Jul 7, 7:37 am, aidy <aidy.le...@googlemail.com> wrote:
Hi,
Could anyone please tell me what the difference would be of inheriting
a class versus passing that class\object through the initialize
method?
class ErrorBox < Box
end
v
box ||= Box.new
class ErrorBox
def initialize(box)
end
end
And why would I do one over the other?
Thanks
Aidy