Batang Mian, Yang Menarik Depan, Teman-Teman Tujuan. Oem: 2004 Sep 20. Tweet; 0.0. 2012-10-24 00:36:15. BHOPAL: In a bid to keep its electronic-media industry alive, Mysuru has taken out a loan of Rs 100 crore for the development of digital media.Q:
Why do I get the error "cannot declare member 'id' inside class 'Songs'" when I try to initialize a variable?
I am getting an error when trying to initialize a variable, id.
Songs* song;
song.id = [[NSUserDefaults standardUserDefaults]objectForKey:@"userid"];
I am getting the following error
Songs.h:20:6: cannot declare member 'id' inside class 'Songs'
Songs.h:20:28: note: previously declared here
I am thinking the error is something with the way I am declaring the variable, but if I declare it outside the class, it does not work.
class Songs {
int id;
NSString* name;
int rate;
NSString* url;
BOOL enabled;
NSArray* song;
Songs()
{
id = [[NSUserDefaults standardUserDefaults]objectForKey:@"userid"];
name = @"ak";
rate = 0;
url = @"";
enabled = YES;
}
}
A:
You have the problem here:
Songs()
{
id = [[NSUserDefaults standardUserDefaults]objectForKey:@"userid"]; be359ba680
Related links:
Commentaires