c++与oc
文章平均质量分 73
azheng11111
这个作者很懒,什么都没留下…
展开
-
2.c++与objective-c中的构造方法(构造函数)
在创建类中属性定义时,不能赋初值,只能靠构造方法来实现 1.c++中的构造函数:在定义类的方法时确定 public: car(int w, int s) // 构造函数 { _wheels = w; _speed = s; } 调用方法时赋初值 int main() { car A(5,原创 2015-09-19 14:31:14 · 428 阅读 · 0 评论 -
1.c++中与oc中类和对象创建及访问
目的:创建对象访问类的属性和方法 1.c++中实现 #include using namespace std; // 使用命名空间 /** * 定义car类 */ class car { private: int _wheels; //car属性1:车的轮子个数 int _speed; //原创 2015-09-19 11:28:44 · 878 阅读 · 1 评论