I have code like following:
#import<ViewModelBase.h>
@interface ViewControllerA : UIViewController
@property (nonatomic, strong) ViewModelBase* viewModel;
@end
Then I need to do something like following:
#import<ViewControllerA.h>
@class ViewModelSubclass;
@interface ViewControllerB : ViewControllerA
@property (nonatomic, strong) ViewModelSubclass* viewModel;
@end
Where ViewModelSubclass.h is not supposed to be imported to ViewControllerB.h, only to .m file. However, ViewModelSubclass is supposed to be subclass of ViewModelBase. This is done to hide interface of ViewModelSubclass from clients of ViewControllerB. How do I solve "Property type 'ViewModelSubclass*' is incompatible with type 'ViewModelBAse*' inherited from ViewControllerA" warning? Or what is a better way to do it?
Aucun commentaire:
Enregistrer un commentaire