定义一个管理员manager类,定义其属性:username(用户名)和password(密码)
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励30(财富值+成长值)
4个回答
展开全部
#import <Foundation/Foundation.h>
@interface Manager:NSObject
{
char *username;
char *password;
}
@property(nonatomic, readwrite) char *username;
@property(nonatomic, readwrite) char *password;
@end
@implementation Manager
@synthesize username;
@synthesize password;
@end
int main (int argc, const char * argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
Manager* a = [[Manager alloc]init];
a.username = "User a";
a.password = "123";
printf("User Name: %s\n", a.username);
printf("User Password: %s\n", a.password);
[pool drain];
return 0;
}
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
class manager{
public:
manager(void);//构造函数
~manager(void);//析构函数
string getUsername();
void setUsername(string newUserName);
string getPassword();
void setPassword(string newPassword);
private:
string username;//定义用户名
string password;//定义密码
};
manager::manager(void){}
manager::~manager(void){}
string manager::getUsername(){
return username;
}
void manager::setUsername(string newUserName){
username = newUserName;
}
string manager::getPassword(){
return password;
}
void manager::setPassword(string newPassword){
password = newPassword;
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
public class Manager {
private String username;
private String password;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
private String username;
private String password;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
public class manager {
private String username;
private String password;
}
private String username;
private String password;
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询