diff options
author | Yannick Loriot <yannick.loriot@gmail.com> | 2013-08-13 16:49:23 +0200 |
---|---|---|
committer | Yannick Loriot <yannick.loriot@gmail.com> | 2013-08-13 16:49:23 +0200 |
commit | 3fe1c3c8a562427533439f385df952a00b36a998 (patch) | |
tree | 45026f166f3bf427d56a4cdc5b4e15c85e97c31f | |
parent | 0d41a6405627b50f2839df3a3b019836f361ecc0 (diff) |
minor update
-rw-r--r-- | objective-c.html.markdown | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/objective-c.html.markdown b/objective-c.html.markdown index f43081cf..22791659 100644 --- a/objective-c.html.markdown +++ b/objective-c.html.markdown @@ -189,6 +189,18 @@ int main (int argc, const char * argv[]) } // => prints "Exception: File Not Found on System" // "Finally" + /////////////////////////////////////// + // Objects + /////////////////////////////////////// + + // Create an object instance by allocating memory and initializing it. + // An object is not fully functional until both steps have been completed. + MyClass *myObject = [[MyClass alloc] init]; + + // The Objective-C model of object-oriented programming is based on message passing to object instances. + // In Objective-C one does not simply call a method; one sends a message. + [myObject instanceMethodWithParmeter:@"Steve Jobs"]; + // Clean up the memory you used into your program [pool drain]; @@ -240,10 +252,6 @@ int main (int argc, const char * argv[]) if ((self = [super init])) { self.count = 1; - - // Create an object instance by allocating memory and initializing it. - // An object is not fully functional until both steps have been completed. - UserObject *someObject = [[UserObject alloc] init]; } return self; } @@ -265,18 +273,6 @@ int main (int argc, const char * argv[]) @end -##Calling Methods - -// The Objective-C model of object-oriented programming is based on message passing to object instances. -// In Objective-C one does not simply call a method; one sends a message. - -[someObject instanceMethodWithParmeter:@"Steve Jobs"]; - -##Nested Messages -// nested messages look like this: - -[someObject instanceMethodWithParmeter:[someObject otherMethodWithString:@"Jony Ive"]]; - ``` ## Further Reading |