i am studying apple obj-c guide and i am having problem understanding class types, the doc says
A class definition is a specification for a kind of object. The class,
in effect, defines a data type. The type is based not just on the data
structure the class defines (instance variables), but also on the
behavior included in the definition (methods). A class name can appear
in source code wherever a type specifier is permitted in C—for
example, as an argument to the sizeof operator:
int i = sizeof(Rectangle);
And sizeof is operator not c method?
And please also clear me what this means
Objects are always "typed by" a pointer.
Sorry, but probably you should start from something easier then obj-c.
In OOP (object-oriented programming) you start from base types (int, long, char, sometimes string, etc.).
Then you have class that contains base types properties and methods (similarly to struct in C).
A class can usually be instantiated, that means you create a object of that type. E.g.
If you write
you created a new object of type Person, with
you can access its method printFullName()
In the example sizeof is a C unary operator (like ++ or –) and Rectangle is a type, a class.
By the way, that example is a bit confusing, search for another one.
means that any object you create is typized by a pointer that defines its type.
Mmmh, it’s hard to explain 🙂
Hope this code can help you 🙂