Official Forum for Programming in Objective-C (the iPhone Programming Language) - Stephen Kochan
May 23, 2018, 11:42:07 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
   Home   Help Search Login Register Chat  
Pages: [1]   Go Down
Author Topic: Chapter 10, Ex. 1  (Read 1554 times)
Posts: 4

« on: May 18, 2011, 01:07:57 PM »

I was wondering, do we have to call the "setWidth:andHeight" method in our initializer?  Can we just do something like this:
Code: (Objective-C)
-(Rectangle *) initWithWidth:(float)w andHeight:(float)h {
self = [super init];

if (self) {
width = w;
height = h;
return self;

To me (a newbie!), it seems odd to be already calling instance methods on an object that we are just now initializing.  It seems like we should do first things first, get the instance set-up and ready to go, then we can call methods on it.

Nitpicking??  Huh
Pages: [1]   Go Up
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Entire forum contents ゥ 2009 All rights reserved.