in reply to opinions on the best way to inherit class data

How about not thinking of it in terms of "class data" but as the data that belongs to a singleton object, the "class" or "factory"? So the only access is via class methods, and no method returns back the raw entire class data. If a subclass wants to extend or manage this data in a distinct way, it can use SUPER calls to get to the data.

This is as opposed to "class instance" data, the data that belongs to each singleton class object. For example, if a Dog inherits from Animal, class data for Animal would also be shared by Dog. But class instance data would be distinct individually for Dogs vs Animals, in which case the class methods would be inherited for behavior but not actual data access.

So, actually, I'm puzzled. Did you mean class data, or class instance data?

-- Randal L. Schwartz, Perl hacker

  • Comment on Re: opinions on the best way to inherit class data