Cannot init a class
来源:互联网 发布:我的世界淘宝服务器 编辑:程序博客网 时间:2024/04/29 22:16
// -------@interface部分 -------//@interface Fraction : NSObject-(void) print;-(void) setNumerator: (int) n;-(void) setDenominator: (int) d;@end // -------@implementation部分 -------//@implementation Fraction{ int numerator; int denominator;}-(void) print{ NSLog(@"%i/%i", numerator, denominator);}-(void) setNumerator:(int)n{ numerator = n;}-(void) setDenominator:(int)d{ denominator = d;}@end // --------@program部分 -------//int main (int argc, char *argv[]){ @autoreleasepool { Fraction *myFraction; //创建一个分数实例 myFraction = [Fraction alloc]; **myFraction = [Fraction init];** // 此处应为[myFraction init] //创建实际的Fraction,并用init方法初始化 [myFraction setNumerator: 1]; [myFraction setDenominator: 3]; NSLog(@"The value of myFraction is: "); [myFraction print]; } return 0;}
0 0
- Cannot init a class
- cannot convert parameter 1 from 'class A' to 'class A'
- class cannot be resolved to a type 或者JSP import class cannot be resolved to
- 主程序调用DLL窗体cannot assign a class to a class问题的彻底解决方案
- cannot assign to 'self' outside of a method in the init family
- Cannot assign to 'self' outside of a method in the init family
- 关于error:Cannot assign to 'self' outside of a method in the init family
- 关于error:Cannot assign to 'self' outside of a method in the init family
- Cannot assign to 'self' outside of a method in the init family
- Cannot assign to 'self' outside of a method in the init family
- [IOS] 错误:Cannot assign to 'self' outside of a method in the init family
- 关于error:Cannot assign to 'self' outside of a method in the init
- [ios]关于error:Cannot assign to 'self' outside of a method in the init family
- 关于error:Cannot assign to 'self' outside of a method in the init family
- 关于error:Cannot assign to 'self' outside of a method in the init family
- 关于error:Cannot assign to 'self' outside of a method in the init family
- 关于error:Cannot assign to \'self\' outside of a method in the init family
- Cannot assign to 'self' outside of a method in the init family
- cocos2d-x核心概念(一)——简述
- Hadoop 之 日志管理——应用在 YARN 中运行时的日志
- Linux Cgroups详解(一)
- CF621D 给出几种指数式子,分别将xyz代入。问哪个式子的值最大
- 远程桌面--外网访问内网多台电脑
- Cannot init a class
- YARN
- 大四生找工作的感悟
- Nginx的平滑升级
- codeforce341 D题 Rat Kwesh and Cheese(复数)
- JAVA中接口与抽象类的区别
- Delphi 如何计算字符串表达式呢?
- SSH项目开发中,将jsp页面放在WEB-INF的原因解析
- Linux configure 参数解释