swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Protocol questions


From: Paul Johnson
Subject: Protocol questions
Date: Fri, 07 Apr 2000 10:48:17 -0500

In a model, the inheritance structure is like this:

                 Recruiter
                      |
                      |
                 ___________
                |           |
               typeA       typeB

To improve compile-time error checking, I declared a protocol
"Recruiter" and both typeA and typeB adopt it, as in.

@interface typeA: Recruiter <Recruiter>

Here are my problems.

1. Suppose typeA and typeB do really different things for a method
"doThis".  I want the Recruiter object to be able to use that method to
get something, say:

      value=[self doThis];

So it gets whatever is appropriate for whatever type it is.

In the Recruiter class, what do I put as the return of a method like
this:
-(int) doThis
{
         [self subclassResponsibility: @selector(doThis)];
        return ???????;
}
 
2. In the Recruiter class, many methods are implemented.  Some methods
are added in typeA that are not in typeB. When I have a typeA object, I
want to use those methods, but programs won't compile.  The compiler
says the method is not in the protocol.  I have to add these methods to
the protocol to get the compiler to work.  


-- 
Paul E. Johnson                       email: address@hidden
Dept. of Political Science            http://lark.cc.ukans.edu/~pauljohn
University of Kansas                  Office: (785) 864-9086
Lawrence, Kansas 66045                FAX: (785) 864-5700

                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]