Amazon.com Widgets Exercise 2
Welcome, Guest. Please login or register.
Did you miss your activation email?
August 04, 2015, 11:26:05 PM
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
|-+ Programming in Objective-C, 4th edition
| |-+ Exercises
| | |-+ Chapter 9
| | | |-+ Exercise 2
Pages: [1] Go Down
Print
Author Topic: Exercise 2 (Read 1302 times)
stuartjj
Newbie
*
Posts: 11






on: June 12, 2012, 05:58:54 AM

What did you all get for an answer to exercise 2?

I think the answer is yes, since the id type can be used to store objects that belong to any class.
Logged
StanleyRShapiro
Newbie
*
Posts: 6


Email




Reply #1 on: June 12, 2012, 10:43:53 PM

One of my concerns was whether the Rectangle shares methods (in name) with the other classes that take as arguments, or return different types than the classes previously assigned to dataValue, but that shouldn't matter here since dataValue is only being set to an instance of an object, and no actual method is being sent to the instance itself.
Logged
Pyr0T3chN3ck
Newbie
*
Posts: 13


Email




Reply #2 on: July 08, 2015, 07:00:39 PM

I wonder if this is one of the situations where just because it "can" doesn't mean that it should. I know the book spoke about the use of static typing and why it is easier, also that consideration should be given to the simplicity of readability. I wonder if since the id type can hold the object as it is initialized just fine if that is isn't recommended. Also I wonder what happens when the dataValue is assigned another object? Does the rectangle simply disappear at that point?
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.