Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Class implementation
#import <Foundation/Foundation.h> @interface Student:NSObject { int age; int rollno; NSString *name; } -(int) rollno; -(int) age; - (NSString*) name; @end @implementation Student -(id)init { self = [super init]; rollno = 10; name = @"Student Name"; age = 22; return self; } -(int) rollno { return rollno; } -(NSString*) name { return name; } -(int) getage { return age; } @end int main( ) { Student *s1 = [[Student alloc]init]; // Create student object int rollno,age; NSString *name; rollno = [s1 rollno]; name = [s1 name]; age = [s1 getage]; NSLog(@"Student Roll No : %d", rollno); NSLog(@"Student Age : %d", age); NSLog(@"Student Name : %@", name); return 0; }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
01 Hola mundo
BookAuther
PRogram 3.2 - simple class
inheritenace-test
Sum Example
array
shape example
simple inheritance in objective c
string
geomatric operations in objective c
Please log in to post a comment.