Monday, May 3, 2010

Objective C Programming Tutorial - 27 - But what if I'm a millionaire?


@interface Person : NSObject {

int age;
int weight;
@property int age,weight;
-(void) print;

-(void) dateAge: (int) a: (int) i;



#import "Person.h"

@implementation Person

@synthesize age,weight;
-(void) print{
NSLog(@"I am %i years old and weigh %i pounds", age, weight);

-(void) dateAge: (int) a: (int) i{

NSLog(@"You can date chicks %i years old", (a/2+7)-(i/100000));




#import "Person.h"

int main (int argc, const char * argv[]) {

NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

Person *bucky = [[Person alloc]init];

bucky.age = 12;

bucky.weight = 540;

[bucky print];

[bucky dateAge:45];

[bucky release];

[pool drain];

return 0;

1 comment:

  1. Sir
    I am new student in C programming language. I want source code from starting chapter of C Programming Tutorials.

    I learing C through your videos so i need of source codes.

    would you like to help me?

    Vishu Tiwari