Thư viện tri thức trực tuyến
Kho tài liệu với 50,000+ tài liệu học thuật
© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

Tài liệu Defining Members pptx
Nội dung xem thử
Mô tả chi tiết
< Day Day Up >
Defining Members
Not all class members are created equal. Using special keywords, members can be
configured in various ways, allowing you to specify how the member is accessed and the
scope of its influence. Next, we'll discuss what this means and how you can use this
functionality when creating class members.
Public and Private Members
By default, all members of a class (its properties and methods) are public. This means
that the property or methods of that class can be accessed by instances of that class. Look
again at our State class definition:
class State {
var statePopulation:Number;
function State() {
//Constructor
}
function setPopulation(num:Number) {
statePopulation = num + (num * .05);
}
function getPopulation():Number {
return statePopulation;
}
}