Class as a Set

A class is naturally also a set that contains all its members. When the class is created, it is an empty set until the constructor is called and a member is added to the set. As a set, a class can be used as the domain of a function parameter, argument, or a class member. For example,
    >>  Dog = class
                 .....
                 .....
            end

    >>  Spot = Dog.new();

    >>  Spot in Dog   // check if Spot is a member of the dog class
              1
    >>  Person = class
                 ...
                 public dog in Dog;
                 ...
        end
Here a member of the Person class has an attribute dog, which has to be a member of the Dog class.



oz 2009-12-22