OC语言中创建了两个类A,B,在B中定义了一个A类型的对象a,a可以在B类中的方法里调用A类的方法吗? 10

@interfaceA:NSObject-(void)test;@end@implementation-(void)test{}@end@interfaceB:NSObj... @interface A:NSObject
- (void)test;

@end
@implementation
- (void) test{
}

@end
@interface B:NSObject{
A a;

}
- (void)test1
@end
@implementation
- (void)test1{
[a test];

}

@end
展开
 我来答
山水阿锐
2015-05-09 · TA获得超过34.3万个赞
知道顶级答主
回答量:23.7万
采纳率:91%
帮助的人:3.1亿
展开全部
您好,
<pre class="brush:as3;toolbar:true;"><!DOCTYPE HTML>
<html>
<head>
<meta property="qc:admins" content="164506634465311636" />
<meta property="qc:admins" content="401713367765311636" />
<meta property="qc:admins" content="61701556566401633636375" />
<meta name="baidu-site-verification" content="xE5s1z5NbE0bsA9g" />
<meta name="google-site-verification" content="rE4V27k6w3Acthr25hhBGoURFpLFjlvwyGXFIspIJSo" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<script>
var _UID_ = 20324;
var _MID_ = 20324;
var _ROOT_ = '';
var _THEME_ = 'http://www.ucai.cn/public/themes/ucaistyle';
var _PUBLIC_ = 'http://www.ucai.cn/public';
var _LENGTH_ = 140;
var _LANG_SET_ = 'zh-cn';
var $CONFIG = {};
$CONFIG['uid'] = _UID_;
$CONFIG['mid'] = _MID_;
$CONFIG['root_path'] =_ROOT_;
$CONFIG['theme_path'] = _THEME_;
$CONFIG['public_path'] = _PUBLIC_;
$CONFIG['weibo_length'] = 140;
$CONFIG['lang'] = 'zh-cn';
var bgerr;
try { document.execCommand('BackgroundImageCache', false, true);} catch(e) { bgerr = e;}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
zend studio 默认建立的html文件头怎么修改 优才网 </title>
<link rel="shortcut icon" href="http://www.ucai.cn/public/themes/ucaistyle/ucai.ico" />
<meta name="keywords" content="zend studio 默认建立的html文件头怎么修改 问答 在线答疑 在线学习平台 在线编程 视频教程 PHP Javascript iOS Objective-C Android 优才网" />
<meta name="description" content="zend studio 默认建立的html文件头怎么修改问答 在线答疑 优才网 是一个集在线学习,疑难解答,知识积累,课后交流为一体的综合在线学习社区" />
<style>
/* Dialog */
.dialog { width: 596px; border-width: 5px; border-style: solid; border-radius: 3px; background: #fff; border-color: rgb(127, 0, 0); border-color: rgba(0, 0, 0, .1); -webkit-background-clip: padding-box; /* for Safari */ background-clip: padding-box; /* for IE9+, Firefox 4+, Opera, Chrome */ }
.dialog_main { background: #fff; border-radius:3px; }
.dialog_title { padding: 15px; border-top: 1px solid #eee; text-align: left; background: #fff; }
.dialog_close { z-index: 99999; display: inline-block; position: absolute; top: 15px; right: 15px; background: url(http://p3.ucai.cn/static/i/dialog-closer.png); width: 19px; height: 19px; font-size: 0px }
.dialog_title h3 { font-size:18px; color: #e54715; font-weight:normal; text-align:center; cursor:default; height:34px; border-bottom:3px solid #f15927; margin-bottom:30px; }
.dialog_title h3 .sub { font-size: 12px; color: #656565; padding-top: 5px; margin-left: 20px; font-weight: normal }
.dialog_bd { padding: 20px 0 }
.dialog .note-title { }
.dialog-bd-wrap { width: 596px; text-align: center }
.dialog-bd-wrap .pub-box { width: 554px; margin: 0 auto; border: 1px solid #78B3D2; box-shadow: inset 0 1px 2px 0 #B5DBF0; overflow: hidden; border-radius: 3px; margin-bottom: 10px }
.dialog-bd-wrap .pub-box .pub-area { width: 550px; overflow-y: auto; height: 64px; border: none; resize: none; font-size: 14px; padding: 2px }
.dialog-bd-wrap .pub-box .pub-bar { width: 100%; background: #F5FCFF; border-top: 1px solid #CDE7F4; height: 45px }
.dialog-bd-wrap .pub-box .pub-bar .button { float: right; margin: 10px 10px 0 0 }
.dialog-bd-wrap .node-list { width: 555px; margin: 0 auto; max-height: 300px; overflow-y: auto }
.dialog-bd-wrap .node-list .node-item { border: 1px solid #C1E1F1; padding: 10px; text-align: left; margin-bottom: 10px }
.dialog-bd-wrap .node-list .node-item p { line-height: 1.8 }
.dialog-bd-wrap .node-list .node-item .index { display: inline-block; background: #CAE5F3; font-weight: bold; color: #5E98C5; border: 1px solid #B5DAED; border-radius: 2px; font-style: normal; width: 16px; height: 16px; line-height: 16px; t</pre>
牧叶草
2020-01-07
知道答主
回答量:20
采纳率:25%
帮助的人:2.9万
展开全部
那肯定的啊,创建对象a 就是为了调用a的方法。。。别无他用
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式