langs a-z

This commit is contained in:
Ingy döt Net 2013-04-10 22:43:41 -07:00
parent db842d013d
commit d066446780
11389 changed files with 98361 additions and 1020 deletions

View file

@ -0,0 +1,11 @@
// There are no class variables, so static variables are used.
static int myClassVariable = 0;
@interface MyClass : NSObject
{
int variable; // instance variable
}
- (int)variable; // Typical accessor - you should use the same name as the variable
@end

View file

@ -0,0 +1,16 @@
@implementation MyClass
// Was not declared because init is defined in NSObject
- init
{
if (self = [super init])
variable = 0;
return self;
}
- (int)variable
{
return variable;
}
@end

View file

@ -0,0 +1,8 @@
// Creating an instance
MyClass *mc = [[MyClass alloc] init];
// Sending a message
[mc variable];
// Releasing it. When its reference count goes to zero, it will be deallocated
[mc release];