![](images/graphics/blank.gif)
Bài giảng Lập trình C# 2010: Chương 5 - ĐH Công nghệ Đồng Nai
lượt xem 15
download
![](https://tailieu.vn/static/b2013az/templates/version1/default/images/down16x21.png)
Bài giảng Lập trình C# 2010: Chương 5 - String Class có nội dung trình bày về: Constructor, String Field, String Operators, String Methods, DEMO String & Dictionary.
Bình luận(0) Đăng nhập để gửi bình luận!
Nội dung Text: Bài giảng Lập trình C# 2010: Chương 5 - ĐH Công nghệ Đồng Nai
- DONG NAI UNIVERSITY OF TECHNOLOGY
- DONG NAI UNIVERSITY OF TECHNOLOGY
- DONG NAI UNIVERSITY OF TECHNOLOGY Abstraction Encapsulation Inheritance Polymorphism
- DONG NAI UNIVERSITY OF TECHNOLOGY Abstraction Characteristics Properties Object Behaviors Methods
- DONG NAI UNIVERSITY OF TECHNOLOGY Encapsulation Characteristic Behaviors s Methods Properties Package
- DONG NAI UNIVERSITY OF TECHNOLOGY Encapsulation private protected public
- DONG NAI UNIVERSITY OF TECHNOLOGY Inheritance • The ability to create a new class from an existing class • The existing class is called the base, superclass, or parent • The inherited class is called the derived, subclass, or child • A derived class has an “is a” relationship with its base class
- DONG NAI UNIVERSITY OF TECHNOLOGY Inheritance
- DONG NAI UNIVERSITY OF TECHNOLOGY Inheritance • Inheritance supports reusability • Reusability – creation of object functionality that may be used in multiple projects
- DONG NAI UNIVERSITY OF TECHNOLOGY Polymorphism • Methods with identical names have different implementations • The Select method is different for radio buttons, check boxes, and list boxes • Allows a single class to have more than one method with different argument lists
- DONG NAI UNIVERSITY OF TECHNOLOGY How to create Class
- DONG NAI UNIVERSITY OF TECHNOLOGY Class Name Constructors Attributes Properties Methods
- public abstract class CAbstractProductDONG NAI UNIVERSITY OF TECHNOLOGY { private string m_strID; private string m_strName; Attributes private string m_strDescription; public CAbstractProduct() { } Constructor public string ID { get { return this.m_strID; } set { this.m_strID = value; } } public string Name { get { return this.m_strName; } Properties set { this.m_strName = value; } } public string Description { get { return this.m_strDescription; } set { this.m_strDescription = value; } } Methods
- DONG NAI UNIVERSITY OF TECHNOLOGY public class CProduct : CAbstractProduct { private double m_dPrice; public CProduct() { } public double Price { get { return this.m_dPrice; } set { this.m_dPrice = value; } } public override void doSomething() {
- public class CBook:CProduct DONG NAI UNIVERSITY OF TECHNOLOGY { private string m_strISBN; private string m_strAuthor; private string m_strTitle; public CBook() { } public string ISBN { get { return this.m_strISBN; } set { this.m_strISBN = value; } } public string Author { get { return this.m_strAuthor; } set { this.m_strAuthor = value; } } public string Title { get { return this.m_strTitle; } set { this.m_strTitle = value; } } }
- DONG NAI UNIVERSITY OF TECHNOLOGY public class CCompactDisc:CProduct { private string m_strArtist; private string m_strTitle; public CCompactDisc() { } public string Artist { get { return this.m_strArtist; } set { this.m_strArtist = value; } } public string Title { get { return this.m_strTitle; } set { this.m_strTitle = value; } } public override void doSomething() { throw new NotImplementedException(); } }
- DONG NAI UNIVERSITY OF TECHNOLOGY public class CTravelGuide:CBook { private string m_strCountry; public CTravelGuide() { } public string Country { get { return this.m_strCountry; } set { this.m_strCountry = value; } } }
- DONG NAI UNIVERSITY OF TECHNOLOGY Garbage Collection
- DONG NAI UNIVERSITY OF TECHNOLOGY • Operator new allocates memory • When objects are no longer referenced, the CLR performs garbage collection • Garbage collection helps avoid memory leaks (running out of memory because unused memory has not been reclaimed) • Allocation and deallocation of other resources (database connections, file access, etc.) must be explicitly handled by programmers
- DONG NAI UNIVERSITY OF TECHNOLOGY • Use finalizers in conjunction with the garbage collector to release resources and memory • Before garbage collector reclaims an object’s memory, it calls the object’s finalizer • Each class has only one finalizer (also called destructor) • Name of a destructor is the ~ character, followed by the class name • Destructors do not receive any arguments
![](images/graphics/blank.gif)
CÓ THỂ BẠN MUỐN DOWNLOAD
-
Bài giảng Lập trình Windows bằng C Sharp (C#) - GV. Nguyễn Thành Chiến
38 p |
233 |
70
-
Bài giảng Lập trình Windows - Phạm Ngọc Hưng (ĐH Bách Khoa)
312 p |
241 |
54
-
Hướng dẫn thực hành lập trình C trên Visual Studio
9 p |
1355 |
31
-
Bài giảng Lập trình C# 2010: Chương 1 - ĐH Công nghệ Đồng Nai
42 p |
128 |
21
-
Bài giảng Lập trình C# 2010: Chương 2 - ĐH Công nghệ Đồng Nai
46 p |
111 |
21
-
Bài giảng Lập trình C# 2010: Chương 2.3 - ĐH Công nghệ Đồng Nai
21 p |
100 |
19
-
Bài giảng Lập trình C# 2010: Chương 3 - ĐH Công nghệ Đồng Nai
47 p |
107 |
18
-
Bài giảng Lập trình C# 2010: Chương 2.4 - ĐH Công nghệ Đồng Nai
16 p |
92 |
18
-
Bài giảng Lập trình C# 2010: Chương 4 - ĐH Công nghệ Đồng Nai
69 p |
112 |
17
-
Bài giảng Lập trình C# 2010: Chương 2.2 - ĐH Công nghệ Đồng Nai
57 p |
85 |
15
-
Bài giảng Lập trình C# 2010: Chương 6 - ĐH Đồng Nai Công nghệ Đồng Nai
74 p |
91 |
15
-
Bài giảng Lập trình C# 2010: Chương 1.1 - ĐH Công nghệ Đồng Nai
17 p |
117 |
14
-
Bài giảng: Lập trình trên Windows với Microsoft® .NET
11 p |
93 |
12
-
Bài giảng Kỹ thuật lập trình nâng cao: Chương 1 - ThS. Dương Thành Phết
52 p |
68 |
7
-
Bài giảng Thiết kế và lập trình Website: Chương 0 - ThS. Dương Thành Phết
13 p |
75 |
6
-
Bài giảng Lập trình giao diện: Chương 1 - Nguyễn Thị Mai Trang
23 p |
46 |
4
![](images/icons/closefanbox.gif)
![](images/icons/closefanbox.gif)
Chịu trách nhiệm nội dung:
Nguyễn Công Hà - Giám đốc Công ty TNHH TÀI LIỆU TRỰC TUYẾN VI NA
LIÊN HỆ
Địa chỉ: P402, 54A Nơ Trang Long, Phường 14, Q.Bình Thạnh, TP.HCM
Hotline: 093 303 0098
Email: support@tailieu.vn
![](https://tailieu.vn/static/b2013az/templates/version1/default/js/fancybox2/source/ajax_loader.gif)