Define encapsulate class type
来源:互联网 发布:如何查看淘宝卖家资质 编辑:程序博客网 时间:2024/06/06 11:00
Encapsulation: encapsulate implement details and hide data.
Inheritance: inherit base class's function and extend base class's behavior
Polymorphism: interface, virtual, abstract, override.
Public, private, protected, internal(access only in current program set), protected internal.
Nested type:
Public class SportsCar
{
private enum CarColor
{
Red, Green, Blue
}
}
Use class type to encapsulate:
class Employee
{
private string empName;
public string Name
{
get { return empName; }
set{ empName=value; }
}
}
Each property hide get_XXX()/set_XXX() method inner CLR, so cannot add this method in current class.
Use property accessor to define a read-only or write-only property.
Static constructor function: initial static data.
Const type, readonly type.
Class MyMathClass
{
public readonly double PI;
public MyMathClass()
{
PI=3.14;
}
}
Class MyMathClass
{
public static readonly double PI;
static MyMathClass()
{
PI=3.14;
}
}
Partial class Employee{}
- Define encapsulate class type
- 坏味道之3 过大类 & Extract class & Move Method & Encapsulate Field & Self Encapsulate Field
- class type
- #define va_arg(AP, TYPE)
- Define one JavaScript class
- Encapsulate collections
- #define list_entry(ptr, type, member)
- #define _syscall0(type,name) 详解
- C++, Define A Type Member
- WinJS.Class.define function
- Ruby Class Function Define end
- Create class type dynamically
- 'point' 'class' type redefinition
- class type redefinition
- class type redefination问题解决
- Java type & Class member
- 关于"class type redefinition"
- First Class Type
- oracle表的管理(数据类型,表创建删除,数据CRUD 操作)
- Program Structure II
- C#参考
- 实现数据加载过程中菊花的方法
- V I M 教 程
- Define encapsulate class type
- eclipse常用功能
- 重构 之代码的坏味道(Bad smell)
- C3P0 代码分析
- Inheritance and polymorphism
- Objective-c SEL & Class IMP
- System.Exception
- 说说代码之美
- Life Cycle of Object