Talk:Objective-C Programming/syntax
Add topicClass Example
[edit source]Why is the very first example of a class derived from another class? Does the example code actually use methods from Object?
I've noticed that other online Objective-C tutorials have the same habit of not showing an example of a non-derived class. The other example I looked at derived its classes from NSObject. Apparently, it makes a difference at a very fundamental level:
Point *point = [Point new]; Point *point = [[Point alloc] init];
The other site used the syntax of the second line for instantiating its very basic object, which looked very much like our Point, except it was derived from NSObject instead of Object. But the instantiation of an object derived from NSObject looks very different from the instantiation of an object derived from Object.
Would a non-derived Point not have a memory-allocation method? Would it also not have a constructor? Perhaps somebody who knows something about Objective-C should write about that. —Preceding unsigned comment added by 216.23.105.2 (discuss • contribs)
Multiple-parameter methods
[edit source]I think it would be nice to have a demonstration of a method with more than 1 parameter, even if it is quite self-explanatory. 194.74.190.163 (talk) 15:11, 17 July 2008 (UTC)
Private methods
[edit source]The methods to set the x and y values are private. Shouldn't they be made public with a '+' so a class outside Point can call it? If i'm correct, this isn't proper Objective C. {{subst:unsigne|80.101.83.92}}
Very nice tutorial, learned much from it! 209.195.82.252 (talk) 01:32, 4 May 2010 (UTC)
Compilation and execution
[edit source]Compiling: gcc -o prog_name prog_name.m
Execution: ./prog_name —Preceding unsigned comment added by 59.93.86.152 (discuss • contribs)
Cast
[edit source]The word "cast" is used but not defined. Can someone who knows what that means fix this? 66.68.133.126 (discuss) 18:58, 23 May 2012 (UTC)
The word "cast" refers to type-casting. —Preceding unsigned comment added by 66.158.178.146 (discuss • contribs)