Style question - including overriden functions in .h file?


#1

Hello all,

quick question while working through the book: while coding the BNRItem class, one includes an overridden version of the NSObject’s designated initializer, -(id)init

I know that the compiler does not need a declaration of the overridden method in the .h file, but is there any stylistic reason why this is not done?


#2

I guess the stylistic reason for not doing this is consistency, and maintainability.

When I read the chapter I looked into if I could (yes), and in which scenarios it should be done. The only reason was if the overriden method did something significantly different than the superclass implementation and you want to express that in the automatically generated documentation.

See: http://stackoverflow.com/questions/1967875/should-i-define-overloaded-inherited-method-in-the-header-file-in-objc