Hello all,
I’m new to objective-c. I want to declare in my method a string and a float and i would like to have the two returned as well.
It’s like this: I want the method to take input for a student’s course and the mark associated to the course.
I cannot figure out the syntax in declaring this so i’m hoping someone here can help. I’m working this out on my own and i don’t have a teacher to go to rather a book and various forums and i’m stuck. Perhaps it’s my logic too so please feel free to tear it apart.
Thanks to everyone here who replies and adds insight to my puzzle.
I have this so far:
INTERFACE
@interface Student: NSObject
{
NSString *subject;
float mark;
}
@property NSString *subject, float mark;
//method that will return both
- (NSString*) newSubject: (float) newMark;
@end
IMPLEMENTATION
#import “Student.h”
@implementation Student
@synthesize subject, mark;
//method to return the subject and mark
- setSubject: (NSString *) newSubject: (float) newMark
{
newSubject = [self subject];
newMark = [self mark];
return newSubject, newMark;
}
@end