This is my first time trying to create an object to store my data and am having some trouble. Im not sure im going about this the right way.
song.h:
#import <Foundation/Foundation.h>
@interface Song : NSObject{
NSString *songID;
NSString *title;
NSString *artist;
NSString *album;
NSString *length;
NSString *votes;
}
-(void)setSongID:(NSString*) p_songId;
-(void)settitle:(NSString*) p_title;
-(void)setartist:(NSString*)p_artist;
-(void)setalbum:(NSString*) p_album;
-(void)setlength:(NSString*) p_length;
-(void)setvotes:(NSString*) p_votes;
-(NSString*)getSongID;
-(NSString*)gettitle;
-(NSString*)getartist;
-(NSString*)getalbum;
-(NSString*)getlength;
-(NSString*)getvotes;
@end
song.m
#import "Song.h"
@implementation Song
-(void)setSongID:(NSString*) p_songId;{
}
-(void)settitle:(NSString*) p_title{
}
-(void)setartist:(NSString*)p_artist{
}
-(void)setalbum:(NSString*) p_album{
}
-(void)setlength:(NSString*) p_length{
}
-(void)setvotes:(NSString*) p_votes{
}
-(NSString*)getSongID{
}
-(NSString*)gettitle{
}
-(NSString*)getartist{
}
-(NSString*)getalbum{
}
-(NSString*)getlength{
}
-(NSString*)getvotes{
}
@end
My implementation file cannot see any of the variables, for example I cannot set the songID with self.songID = p_songID
Does objective-c have a built in way of dealing with these setters/getters, am I going about this the wrong way?