What's the difference between #import and @class
Sabtu, 08 Juni 2013
0
komentar
#import
brings the entire header file in question into the current file; any files that THAT file #import
s are also included. @class, on the other hand (when used on a line by itself with some class names), just tells the compiler "Hey, you're going to see a new token soon; it's a class, so treat it that way).This is very useful when you've got the potential for 'circular includes'; ie, Object1.h makes reference to Object2, and Object2.h makes reference to Object1. If you
#import
both files into the other, the compiler can get confused as it tries to #import
Object1.h, looks in it and sees Object2.h; it tries to #import
Object2.h, and sees Object1.h, etc.If, on the other hand, each of those files has
@class Object1;
or @class Object2;
, then there's no circular reference. Just be sure to actually #import
the required headers into your implementation (.m) files.TERIMA KASIH ATAS KUNJUNGAN SAUDARA
Judul: What's the difference between #import and @class
Ditulis oleh Unknown
Rating Blog 5 dari 5
Semoga artikel ini bermanfaat bagi saudara. Jika ingin mengutip, baik itu sebagian atau keseluruhan dari isi artikel ini harap menyertakan link dofollow ke https://apk-zenonia5.blogspot.com/2013/06/what-difference-between-import-and-class.html. Terima kasih sudah singgah membaca artikel ini.Ditulis oleh Unknown
Rating Blog 5 dari 5
0 komentar:
Posting Komentar