Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save fernandojinzenji/ef79247b77ac9a243f9e984243529e68 to your computer and use it in GitHub Desktop.
Save fernandojinzenji/ef79247b77ac9a243f9e984243529e68 to your computer and use it in GitHub Desktop.
Week 1 (Saturday) - Questions
Question 1
Answer: MVC - Model holds all the information (data, state) and logic the store this information. View is the presentation for those
Models. Any changes in their state are informed to the View so it can change and update their presentation. Controller is
responsible to intermediate Model and View communication, when for example, a View needs to update a information stored in
the Model or when the Model needs to inform the View that an information is changed and needs to be updated in the View.
Question 2
Answer: An NSObject protocol allows multiple root classes to all have the same basic methods, and also makes it easy to
declare a protocol which also includes basic functionality expected of any object. The NSObject class conforms to the
NSObject protocol, bringing everything together.
Question 3
Answer:
@interface LLShoutingPerson : LLPerson
-(instancetype)initWithLoudMessage:(NSString*)msg;
@end
@implementation LLShoutingPerson
-(instancetype)initWithLoudMessage:(NSString*)msg
{
self = [super initWithMessage:msg];
if(self)
{
_ivar_for_message = [msg uppercaseString];
}
return self;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment