Cristian Contreras
Cristian Contreras

Reputation: 113

Objects in object oriented programming in objective c

Newbie programmer here who has programmed in C before and I am now starting to learn object oriented programming since I want to program for iOS in the future. I've read the Apple documentation and most of it is crystal clear, except that I am having trouble understanding objects, which are obviously supposed to be basic knowledge. The Apple documentation reads as follows:

"All members of a class are able to perform the same methods and have matching sets of instance variables. Two objects with equivalent data structures but different methods would not belong to the same class."

So my question is, if all objects have shared methods, and all objects have matching sets of instance variables, then what on earth is the difference between objects within the same class?? I thought objects were composed of just instance variable and methods

Thanks to anyone who answers

Upvotes: 0

Views: 344

Answers (1)

CRD
CRD

Reputation: 53010

I think your misunderstanding comes from Apple's use of the language "matching sets". An instance of a class has the same methods as every other instance and its own set of instance variables. So each instance is distinct from every other instance.

Upvotes: 1

Related Questions