Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Class implementation using get method
#import <Foundation/Foundation.h> @interface Student:NSObject { NSString *name; long mno; NSString *email; int enroll; int avg_mark; } @end @implementation Student -(id)init { self = [super init]; mno = 8866839755; name = @"Student Name"; email = @"parthganatra97@gmail.com"; enroll = 22; avg_mark=100; return self; } -(long) get_moblie_number { return mno; } -(NSString*) get_name { return name; } -(int*) get_enroll { return enroll; } -(NSString*) get_email { return email; } -(int*) get_mark { return avg_mark; } @end int main( ) { Student *s1 = [[Student alloc]init]; // Create student object //long rollno = [s1 get_moblie_number]; NSString *name = [s1 get_name]; //age = [s1 getage]; NSLog(@"Student Mobile No : %ld", [s1 get_moblie_number]); NSLog(@"Student Name : %@", [s1 get_name]); NSLog(@"Student Enrollment No : %d", [s1 get_enroll]); NSLog(@"Student Email : %@", [s1 get_email]); NSLog(@"Student Average Mark No : %d", [s1 get_mark]); return 0; }
run
|
edit
|
history
|
help
0
nsset
Interface implementation
find maximum in objective c
Book NSSet
string
asdfghjk
Obj-C_Program_Structure_1
Simple Arithmetic Operations in Objective C
string search
string divison