摘要:
//C++单例模式:指一个类只生成一个对象#includeusingnamespacestd;classA{public: staticA* getA(); staticA* a; intb =0; voidfunAdd(){ b++; coutfunAdd(); if(i ==4) { (A::getA())->funClear(); } } return0;} 阅读全文
摘要:
Student.h:#import @interface Student : NSObject@property(nonatomic,retain) NSString * name;@property(nonatomic,assign) int age;@endStudent.m:#import "Student.h"@implementation Student//动态方法,在main函数中类alloc了之后调用,但是要手动管理内存,要手动释放-(id) initWithAge:(int)age{ if (self == [super init]) { _age = ag 阅读全文