Quote:
Originally Posted by Eric_Cartman
Hi, this is my first post here Smiley
Assuming there is a class call "MyClass" which contain a method call "HelloWorld".
I see some example doing this:
MyClass* class = [ [MyClass alloc] init ];
[class HelloWorld];
[class release];
=================================
On another book I see this:
id class = [MyClass new];
[myclass HelloWorld];
========================================
My Question is...does the both of them work equally ?
One with "*" and one does not....one contain "release" and one does not...
which one of the two should I use ?
|
new=Allocates a new instance of the receiving class, sends it an init message, and returns the initialized object.This method is a combination of alloc and init.
alloc=Returns a new instance of the receiving class.