Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
abc
#import <Foundation/Foundation.h> @interface rectangle : NSObject { double length,base; } +(double)getPi; -(void)setlength:(double)l; -(void)setbase:(double)b; -(double)getArea; @end @implementation rectangle -(void)sethight:(double)l { length=l; } -(void)setbase:(double)b { width=w; } -(double)getArea { return 1/2*l*b; } @end @interface Cylinder : Circle { double height; } -(void)setHeight:(double)h; -(double)getArea; @end @implementation Cylinder -(void)setHeight:(double)h { height = h; } -(double)getArea:(double)r { //Circle *c = [[Circle alloc]init]; //[c setRadius:3]; return height*r*r*3.14; } @end int main (int argc, const char * argv[]) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; Circle *c1 = [[Circle alloc]init]; [c1 setRadius:3.5]; NSLog (@"Area : %lf",[c1 getArea]); Cylinder *cy1 = [[Cylinder alloc]init]; [cy1 setHeight:5.0]; NSLog (@"Area : %lf",[cy1 getArea:3.5]); [pool drain]; return 0; }
run
|
edit
|
history
|
help
0
string
nsset
NSSet(Create,Enumrate,Compare,Checking,Combine)
Book NSSet
02 Mostrar valor de variable entera
PRogram 3.2 - simple class
Func Var and Ops ObjC
Az Flights Optimization
string compare
NSString Examples in one