Nosrettap
Nosrettap

Reputation: 11340

What to do when .h file is empty in objective c?

I have a class hierarchy where I have a super class and then a whole bunch of subclasses that extend it. The issue though is that these subclasses don't ever add new methods or properties. Instead, they just override one of the super classes methods (in essence making it abstract). This leaves the .h files for the subclasses completely empty (except for the @interface and @end lines).

What is the most appropriate action? Should I just leave these practically empty .h files or is there some better way to deal with this situation?

Upvotes: 1

Views: 200

Answers (2)

tjg184
tjg184

Reputation: 4686

You could leave the header files blank or you could just get rid of them all together and have 1 file which has both the header and implementation, like below.

@interface BaseClass: MySuperClass {
}
@end

@implementation BaseClass

@end

Upvotes: 1

DrummerB
DrummerB

Reputation: 40211

Just leave them empty, that's perfectly fine.

Upvotes: 4

Related Questions