Can anyone explain me how inheritance works under the hood in Objective-C ?
Lets say I have class B which inheritance class A. What is the glue between those two clases so class B to be able to access properties and methods of class A ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
isa.The
isaidentifies the type at runtime, and refers to its dynamic ‘glue’ (see vtable). Because ofisa, the runtime knows (or is able to determine) which methods to perform when a message is sent, as well as the type ofself.When an instance is created, its
isais assigned.The other primary contributor is, of course, the compiler, which takes over when you get down to the lower levels — e.g. accessing instance variables directly and defining methods. There are a number of calls the compiler adds when creating objects and when messaging.