代码如下:- #import <Foundation/Foundation.h>
 
  
- @interface Score : NSObject
 
 - {
 
 -     int _cScore;
 
 -     int _ocScore;
 
 - }
 
 - @end
 
  
- @implementation Score
 
  
- @end
 
  
- // 继承:xx 是 xxx
 
 - // 组合:xx 拥有 xxx
 
  
- @interface Student :NSObject
 
 - {
 
 -     int _no;
 
 -     int _age;
 
 -     Score *_score;
 
 - }
 
  
- @end
 
  
- @implementation Student
 
  
- @end
 
  
- int main()
 
 - {
 
 -     
 
 -     return 0;
 
 - }
 
  复制代码 这里用到的时组合,有个疑问就是在组合关系里,Student类里面是如何访问Score里面的 _cScore、 _ocScore成员变量的??望各位能解答下疑惑! 
 
 |   
        
 
    
    
    
     
 
 |