详细解释下AS 3.0中的get和set方法!
2个回答
2013-03-27
展开全部
作用和JAVA中的一样,不过AS 3.0中基本不用get和set方法。完全浪费。只有在JAVA的WEB编程中才有用到。就是把类Cat的属性比如str设为private时,Cat的一个对象比如cat就不能直接给cat.str取值和给值了,因为private的属性在Cat类外是访问不到的。这时就能用个public的get和set方法来了。如下java例子。as中同理:
public class CMMGR104InputVO {
public CMMGR104InputVO() {
}
private String scheduleId;
private String scheduleName;
private String description;
private int pageNumber;
public String getScheduleId() {
return scheduleId;
}
public void setScheduleId(String scheduleId) {
this.scheduleId = scheduleId;
}
public String getScheduleName() {
return scheduleName;
}
public void setScheduleName(String scheduleName) {
this.scheduleName = scheduleName;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public int getPageNumber() {
return pageNumber;
}
public void setPageNumber(int pageNumber) {
this.pageNumber = pageNumber;
}
}
public class CMMGR104InputVO {
public CMMGR104InputVO() {
}
private String scheduleId;
private String scheduleName;
private String description;
private int pageNumber;
public String getScheduleId() {
return scheduleId;
}
public void setScheduleId(String scheduleId) {
this.scheduleId = scheduleId;
}
public String getScheduleName() {
return scheduleName;
}
public void setScheduleName(String scheduleName) {
this.scheduleName = scheduleName;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public int getPageNumber() {
return pageNumber;
}
public void setPageNumber(int pageNumber) {
this.pageNumber = pageNumber;
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询