Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Objective C language [NEWBEE QUESTIONS]



Am 30.01.2004 um 13:08 schrieb Alexander F. Hartner:
1. ) Private methods:
Is it possible to declare a method as private. From what I found out so
far it is not, but a similar behaviour may be achieved by declaring a
private category. How would one declare a private category. One example
I found simple named the category "Private", but this seems to easy /
wrong to me.

There's no support at the language level. But just don't declare them in the header file.


2.) Abstract methods:
Is is possible to declare methods / classes as abstract. Conceptually I
see that it is possible, but how is it done in practice to prevent
instantiation of a class?

Methods: e. g. raise an "unimplemented" exception.
Classes: e. g. override alloc, return nil


3.) Inheritance of the constructor / class methods
Is seems to me that the constructor is inherited as well. Does this
mean that inheritance covers class methods (i.e. +) as well ?

Yes. Classes are treated as objects.


4.) Runtime adoption
This might be the most misguided question of all. Is it possible to
adopt a protocol at runtime, i.e. without having it declared before. I
vaguely remember reading in a tutorial that the Objective C language
supports a feature along the lines of adopting a protocol at runtime.
Is there such a thing

I'd say yes.


and how is it done.

Look into <objc/*.h>.


Re
Phil
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Objective C language [NEWBEE QUESTIONS] (From: "Alexander F. Hartner" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.