Kochan 2.0 Exercise 10-2 ....a question

Discussion in 'Mac Programming' started by mdeh, Jan 24, 2009.

  1. macrumors 6502

    Joined:
    Jan 3, 2009
    #1
    The exercise:
    Given that you label the method developed in exercise 1 the designated initializer for the Rectangle class, and based on the Square and Rectangle class definitions from Chapter 8, add an initializer method to the Square class according to the following declaration:
    -(Square *) initWithSide: (int) side;


    Question.

    We have covered type "id" on page 194, and designated initializers on page 206. Would it be more correct to declare "id" as the return value data type than (Square *)? OR have we not reached this point yet?
     
  2. macrumors newbie

    TotalLuck

    Joined:
    Jan 3, 2009
    Location:
    Moreno Vallley
    #2
    I think it should be (Square *)

    After the last problem in chapter 9, I am assuming that if you know the type I object that you are working with , then you would use that object (Square *) Instead of (id).
     

Share This Page