James Edward Gray II wrote:
> On Jul 14, 2005, at 9:49 AM, GáÃor SEBESTY¥ÎN wrote:
>
>> Hi,
>>
>> What is the difference between
>>
>>     obj.kind_of?(Customer)
>>
>> and
>>
>>     obj.class == Customer.class
>>
>> ?
>> The earlier works but the latter don't. Why?
>
> Customer is a "class", so when you ask for Customer.class you're
> probably getting Class as an answer.  I believe what you meant is:
>
> obj.class == Customer
>
> Another way to write that is using the "case equals" method (used to
> resolve case statements):
>
> Customer === obj
>
> Hope that helps.
>
> James Edward Gray II

Just for the sake of completeness: obj.kind_of? Customer is equivalent to
Customer === obj while obj.class == Customer has different semantics.  The
latter form test for the exact class only while both former variants test
for classes and sub classes.

Kind regards

    robert