Re: Using Categories
Re: Using Categories
- Subject: Re: Using Categories
- From: Ryan Bates <email@hidden>
- Date: Mon, 9 Feb 2004 12:32:09 -0800
On Feb 9, 2004, at 11:12 AM, Alexander F. Hartner wrote:
For me to make use of the additional functionality added within the
category, do i need to import Car.h or SuperDuperCar.h ?
You need to import SuperDuperCar.h because Car.h knows nothing about
the extended methods. Technically you do not have to import Cart.h as
well, but it wouldn't hurt. It's probably not a good idea to assume
files are importing other files anyway.
Once SuperDuperCar.h is loaded / imported, are other instanced of Car
instantited before the loading of the category also transformed to
SuperDuperCar's ?
Yes, this is one reason why categories cannot have instance variables.
When creating an instance of a class you are only creating another copy
of the class's instance variables - not the methods. In other words,
all the methods are handled in one place: the class object. So, after
extending that class, all instances of that class will respond to those
methods.
At least this is how I understand it, someone please correct me of I'm
wrong.
Ryan
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.