Classes, Objects, and Structures
2006-03-02 21:50
141 查看
Object-Oriented Programming (OOP) is a software development paradigm that suggests developers to split a program in building blocks known as objects. The OOP paradigm allows developers to define the object as data, functions, and its relationship with other objects.
Class
The most common definition states that a class is a template for an object.
Access keywords
Access keywords define the access to class members from the same class and from other classes. The most common access keywords are:
Public: Allows access to the class member from any other class.
Private: Allows access to the class member only in the same class.
Protected: Allows access to the class member only within the same class and from inherited classes.
Internal: Allows access to the class member only in the same assembly.
Protected internal: Allows access to the class member only within the same class, from inherited classes, and other classes in the same assembly.
Static: Indicates that the member can be called without first instantiating the class.
Object
Objects are the building blocks of OOP and are commonly defined as variables or data structures that encapsulate behavior and data in a programmed unit. Objects are items that can be individually created, manipulated, and represent real world things in an abstract way.
Structures
Not everything in the real world should be represented as a class. Structures are suitable to represent lightweight objects. Structures can have methods and properties and are useful for defining types that act as user-defined primitives, but contain arbitrary composite fields.
Class
The most common definition states that a class is a template for an object.
Access keywords
Access keywords define the access to class members from the same class and from other classes. The most common access keywords are:
Public: Allows access to the class member from any other class.
Private: Allows access to the class member only in the same class.
Protected: Allows access to the class member only within the same class and from inherited classes.
Internal: Allows access to the class member only in the same assembly.
Protected internal: Allows access to the class member only within the same class, from inherited classes, and other classes in the same assembly.
Static: Indicates that the member can be called without first instantiating the class.
Object
Objects are the building blocks of OOP and are commonly defined as variables or data structures that encapsulate behavior and data in a programmed unit. Objects are items that can be individually created, manipulated, and represent real world things in an abstract way.
Structures
Not everything in the real world should be represented as a class. Structures are suitable to represent lightweight objects. Structures can have methods and properties and are useful for defining types that act as user-defined primitives, but contain arbitrary composite fields.
相关文章推荐
- Classes and Objects :类和对象(1)
- Classes and Objects
- Python’s objects and classes — a visual guide
- C++ Super-FAQ 『Classes and Objects』
- Objective-C Classes Are also Objects
- Classes and Objects in PHP5(4)
- 第九节--绑定 -- Classes and Objects in PHP5 [9](转)
- dhl:类型“System.Data.Objects.DataClasses.EntityObject”在未被引用的程序集中定义必须添加对程序集“System.Data.Entity"引用
- 编译器错误消息: 类型“System.Data.Objects.DataClasses.EntityObject”在未被引用的程序集中定义。
- 设计思维点滴二:classes and objects
- [轉]Flash AS3 物件 (objects) 與類別 (classes)
- 编译器错误消息: 类型“System.Data.Objects.DataClasses.EntityObject”在未被引用的程序集中定义。
- Exporting classes containing std:: objects (vector, map, etc) from a dll
- 摘自PHP手册[3] – Classes/Objects 类/对象函数
- 02-03.类和对象 Classes and Objects
- 第一节--面向对象编程 -- Classes and Objects in PHP5 [1]
- 第九节--绑定 -- Classes and Objects in PHP5 [9]
- Classes and Objects :类和对象(2)
- OOP (Objects and Classes )