Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
Objective-C keywords 
 

Here in this section we will know about the keywords used in objective-C language.

 

Objective-C keywords

                         

Here in this section we will know about the keywords used in objective-C language. Objective-C is a superset of C language, so program written in c and C++ should compile as objective-c. It provides some additional keywords, to avoid conflict with keywords in other language it uses ‘@’ at the beginning of keyword. These keyword are called Compiler Directives.

 

Directives used to declare and define classes, categories and protocols:

Directive Definition
@interface used to declare of class or interface.
@implementation used to define a class or category.
@protocol used to declare a formal protocol.
@end ends the declaration, definition, category or protocol.


Directive used to specify the visibility of the instance. Default is @protected.
Directive Definition
@private Limits the scope of an instance variable to the class that declares it.
@protected Limits instance variable scope to declaring and inheriting classes.
@public Removes restrictions on the scope of instance variables.

Exception handling directives.

Directive Definition
@try Defines a block within which exceptions can be thrown.
@throw Throws an exception object.
@catch Catches an exception thrown within the preceding @try block.
@finally A block of code that is executed whether exceptions were thrown or not in a @try block.

Directive used for particular purpose.

Directive Definition
@class Declares the names of classes defined elsewhere.
@selector(method_name) It returns the compiled selector that identifies method_name.
@protocol(protocol_name) Returns the protocol_name protocol (an instance of the Protocol class). (@protocol is also valid without (protocol_name) for forward
declarations.)
@encode(type_spec) Yields a character string that encodes the type structure of type_spec.
@"string" Defines a constant NSString object in the current module and
initializes the object with the specified 7-bit ASCII-encoded string.
@"string1" @"string2" ...
@"stringN"
Defines a constant NSString object in the currentmodule. The string
created is the result of concatenating the strings specified in the two
directives.
@synchronized() Defines a block of code that must be executed only by one thread
at a time.


Some keywords of Objective-C are not reserved outside. These are…..

in out inout bycopy
byref oneway    

Keyword for memory management in Objective-C 
These are looking as keywords but infact these are methods of root class NSObject.

alloc retain release autorelease

Some other keywords:

1.  bool
is a keyword used in objective-C but its value is here YES or NO. In C and C++ it has value either TRUE or FALSE.
2. 'super' and 'self' can be treated as keywords but self is a hidden parameter to each method and super gives the instructions to the compiler that how to use self differently.

Preprocessor Directives
The preprocessor directives are special notations:

Directive Definition
// This is used to comment a single line.
#import  Like C and C++ it is used to include a file but it doesn't include more than once.

                         

» View all related tutorials
Related Tags: iphone c programming mac application import object language io sed system ip port applications this app for phone program to

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.