1. Trang chủ
  2. » Công Nghệ Thông Tin

Tài liệu Classes pdf

2 286 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề A.2 Classes
Tác giả Team Lib
Thể loại Chapter
Định dạng
Số trang 2
Dung lượng 11,76 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

[ Team LiB ]A.2 Classes C# uses the class statement along with opening and closing braces, { }, to indicate the beginning and end of a class definition.. For example: public class DataE

Trang 1

[ Team LiB ]

A.2 Classes

C# uses the class statement along with opening and closing braces, { }, to indicate the

beginning and end of a class definition For example:

public class DataException : SystemException {

// Member definitions

}

In VB, a class definition is indicated by the Class End Class construct:

Public Class DataException

Inherits SystemException

' member definitions

End Class

In addition, C# classes can be marked as abstract or sealed; these correspond to the VB MustInherit and NonInheritable keywords, as shown in Table A-2

Table A-2 C# and equivalent VB class modifiers

abstract MustInherit sealed NonInheritable

C# uses the colon to indicate either inheritance or interface implementation Both the

base class and the implemented interfaces are part of the class statement For example:

public class DataSet : MarshalByValueComponent, IListSource,

ISupportInitialize, ISerializable

In VB, the base class and any implemented interfaces are specified on separate lines

immediately following the Class statement A class's base class is indicated by preceding its name with the Inherits keyword; any implemented interfaces are indicated by the

Implements keyword Hence, the previous definition of the DataSet class in C# would

appear as follows in VB:

Public Class DataSet

Inherits MarshalByValueComponent

Implements IListSource, ISupportInitalize, ISerializable

Trang 2

[ Team LiB ]

Ngày đăng: 14/12/2013, 18:16

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

w