Metaclass/AbstractClass 
Author Message
 Metaclass/AbstractClass

Quote:

>I am having trouble to understand what a Metaclass is. If I understand
>correctly, it is a class that has a unique instance which is a class. Is it
>usual to have classes as instances of class? Also, what would be the use of a
>class whitout instances (abstract class right?)? Is it to encapsulate
>behavior, or adding functionality without changing the superclass? Thanks,

Everything in Smalltalk is an object, including classes.  Every object
has a class, including classes.  The class of a class is a special
kind of class called a metaclass.  "Array" is a class.  "Array class"
is a metaclass.  Metaclasses have one instance, and they don't have
a name, but share their one instance's name.  "Array class" stores
the methods that are used to implement messages to the class "Array",
hence metaclasses hold class methods.

An abstract class does more than just encapsulate behavior, it acts
as a template for its concrete subclasses.  In Smalltalk, Object, Collection,
Number, and Stream are all abstract classes.

-Ralph Johnson



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. metaclass explicitly defined

2. metaclass explicitly defined

3. Let me try again....Metaclass construction

4. What is a Metaclass?

5. More Metaclass fun

6. MetaClass construction

7. VW: Why Metaclass is not garbaged?

8. Metaclass=nil, what methods are required ?

9. Metaclass justification

10. Does Oberon support a explicitly metaclass mechanism

11. Metaclass for putting class names into .environment

12. Metaclass oddity

 

 
Powered by phpBB® Forum Software