When I write:
MyClass *obj = [[MyClass alloc]init];
I can split in 2 parts:
-
[MyClass alloc]—>> produce something -
[theProduct init];
So alloc is a Class methods and being init an instance method i suppose that it must be called on an instance…in this case the result of [MyClass alloc].
I’m really confused about that.
Are my conjectures correct?
+allocallocates and zeroes the memory for an instance of a class. This instance is uninitialized—it’s not ready to be used as an object until you initialize it with-initor related.