Official Forum for Programming in Objective-C (the iPhone Programming Language) - Stephen Kochan
December 16, 2017, 09:19:22 PM *
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
  Print  
Author Topic: Chapter 10, Ex. 1  (Read 1468 times)
njordan2001
Newbie
*
Posts: 4


Email
« 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
Logged
Pages: [1]   Go Up
  Print  
 
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 classroomM.com. All rights reserved.