Yes, a class object is a full-fledged object, so you can do anything to it that you can do with a regular object.
However, it is clearer and simpler to use a global variable.
p.s. Associating it with [self class]
is not the same as using a global variable, because [self class]
gives you the actual class of the current object, which may vary as this method is inherited by subclasses. Whereas with a global variable it would always be the same variable.