There are three cases where this can come up. First of all, inheritance;

TUPLE: animal ;
TUPLE: cat < animal ;

cat new animal? . => t
cat new cat? . => t

Here the new instance of cat is both a cat and an animal.

The second is unions and mixins:

TUPLE: chicken < animal ;
TUPLE: cow < animal ;
UNION: tasty cow chicken ;

cow new tasty? . => t
cow new cow? . => t

The third is predicate classes:

TUPLE: pig weight ;
PREDICATE: underweight-pig weight>> 300 < ;

pig new 250 >>weight pig? . => t
pig new 250 >>weight underweight-pig? . => t

Every object will have a most specific concrete class it is an
instance of, however there may be unions, predicates and superclasses
that it is also an instance of. Generic words dispatch to the most
specific method first; if such a method is not defined, or it is
defined and it calls call-next-method, then it will try all least
specific methods in order.

Slava

On Thu, Oct 22, 2009 at 7:56 AM, Elisabeth Wittek
<[email protected]> wrote:
> Hello,
>
> at the moment I´m writing a paper about the object-oriented system in Factor
> for my studies.
> I´ve got a question about an object being an instance of more than one
> class. Can you give me a short example where this is realized or any further
> information? I don´t get it at all ;)
>
> Thanks a lot,
> Elisabeth
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Factor-talk mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to