Is it a good programming practice to have a class with several .h files?
Posted
by
Jim Thio
on Programmers
See other posts from Programmers
or by Jim Thio
Published on 2012-06-03T03:58:12Z
Indexed on
2012/06/03
10:47 UTC
Read the original article
Hit count: 250
programming-languages
I suppose the class have several different interfaces. Some it shows to some class, some it shows to other classes.
Are there any good reason for that?
One thing I can think of is with one .h per class, interface would either be public or private.
What about if I want some interface to be available to some friends' class and some interface to be truly public?
Sample:
@interface listNewController:BadgerStandardViewViewController <UITableViewDelegate,UITableViewDataSource,UITextFieldDelegate,NSFetchedResultsControllerDelegate,UIScrollViewDelegate,UIGestureRecognizerDelegate> {
}
@property (nonatomic) IBOutlet NSFetchedResultsController *FetchController;
@property (nonatomic) IBOutlet UITextField *searchBar1;
@property (nonatomic) IBOutlet UITableView *tableViewA;
+ (listNewController *) singleton; //For Easier Access
-(void)collapseAll;
-(void)TitleViewClicked:(TitleView *) theTitleView;
-(NSUInteger) countOfEachSection:(NSInteger)section;
@end
Many of those public properties and function are only ever called by just one other classes. I wonder why I need to make them available to many classes.
It's in Objective-c by the way
© Programmers or respective owner