Creating view controller - Page 132


Hi Joe,

Why have we created view controller like this.
UIViewController *vc1 = [[HypnosisViewController alloc] init];

I mean why cant / didnt we write
HypnosisViewController *vc1 = [[HypnosisViewController alloc] init];



It won’t matter in this case. ObjC isn’t statically typed so what you call an object (the type of the variable that points to it) doesn’t affect its type. Since we only need to know that this is a UIViewController (not the details about the subclass, HypnosisViewController), this is okay.