Amazon.com Widgets Chapter 10, Ex. 1
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 19, 2014, 01:38:38 AM
Home Help Search chat Login Register 
News: Read this please.The Great Kangaroo Escape Looking for reviews of the 4th ed on Amazon!   Twitter:  @skochan
                     

+ Official Forum for Programming in Objective-C (the iPhone Programming Language) - Stephen Kochan
|-+ Old Stuff
| |-+ Answers to Exercises
| | |-+ Chapter 10
| | | |-+ Chapter 10, Ex. 1
Pages: [1] Go Down
Print
Author Topic: Chapter 10, Ex. 1 (Read 896 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:



Login with username, password and session length

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 (c) 2009 classroomM.com. All rights reserved.