I'm new to Objective-C and want to know about heritage. I know about the concepts, but are confused by the ways in which the programmer uses the heirs of a class.
I have two classes: Class A and Class B, and B. want to make a child of A.
Sometimes the programmer uses the #import "class A"
and sometimes uses the @
sign, which of which use Should be done and why? Is there any difference in their experiments?
I have another question about ":
" which we write after the class declaration, for example @interface class_A: class_name
In the past, I was a student of Java and C #, and their heritage is similar to each other but what purpose-C (I am currently working for the iPhone) is the same?
There is a difference in those words, and I can see where your confusion is.
Any time you need to declare that an object is valid - the keyword #import
should be added here.
With C # and Java, the heir is obtained using the operator in your H file. So in the declaration of class B, it should go:
@interface Class_B: Class_A
Hope it clears everything.
Update your comment:
Suppose I want to make the successor of Class B in Class B, and anywhere in the form of a C I want to use Class C You will need FF to work on it:
#import "Class_A.h" @ class square_C; @ Interface class_b: class_a {class_c * heavy}} Now, let's say somewhere inside your file, which you can access to classgong members like
when you changemyvariable.Property1
You need to turn on "class_C.h"@ class Class_C
to#import.
I do not seem to declare it like this:
@ square class_a; @ Interface class_b: class_a
will work ... you will still need to
#import "Class_A.h"
, which makes the class@
Declaration is something unnecessary.
Comments
Post a Comment