Day-1 Flashcards

1
Q

NSObject

A

All the Classes are descendants of the root class of NSObject

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

The Asterisk *

A

Reference to variable live in the stack and usually refers to space in memory (memory address)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Init in Class

A

We always return instance type (Self) with every init in a class

There’s always one overarching init and we can create other designated initializers (we also call them convenience inits)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

External and Static Variables

A

An external variable is one whose value can be accessed and changed by any other methods or functions. Inside the module that wants to access the external variable, the variable is declared in the normal fashion and the keyword extern is placed before the declaration. When dealing with external variables, you can declare a variable as extern in many places, but you can define it only once: extern int gMoveNumber;

Static variables are global but not external. In other words, you want to define a global variable to be local to a particular module (file). You might want a class method to be capable of setting and accessing variables

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Typedef

A

It’s the alternative to TypeAliases in Swift

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Categories

A

Categories in Objective-C are essentially extensions in Swift and used for the exact same purpose

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Protocol in Objective-C

A

A protocol is a list of methods that is shared among classes. The methods listed in the protocol do not have corresponding implementations and you cannot extend Objective-C protocols

Swift manipulate a lot with protocols which is awesome!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q
  • +
    Class
A

” - “ is always an instance
“ + “ class method
without them it’s just a Class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly