数据结构与算法一().ppt

数据结构与算法一()

Class Definitions A Class definition allows the programmer to group variables and functions together Variables defined in a Class are called data members Functions defined in a class are called member functions or methods Class definitions are often used to implement ADTs Chapter 1: Introduction EXMP: List Classes and Objects A Class is the OOP term for a data structure A Class can be thought of as an Object Factory Class definitions include variables and functions An Object is an instantiation of some Class The type of an Object is the name of the Class whose definition was used to create it Objects occupy storage Chapter 1: Introduction EXMP: List Struct and Class Used to declare aggregate data or data types C has a limited struct capability In C++, structs and classes are very similar Structures and classes allow C and C++ programmers to create user-defined types Support encapsulation Encourage code reuse Chapter 1: Introduction EXMP: List Struct Example struct Employee{ char name[20]; int age; }; The new type is Employee Employee x,y; //creates two instances of Employee data items name and age are members of the struct Chapter 1: Introduction EXMP: List * Data Structures and Algorithms Chapter 1: Introduction Class Information Syllabus Overview Algorithms Data Structures Outline Course website Class information are posted on the course website: /C2247/Asp/Root/Index.asp Lecture notes, programming assignments are posted on the web site frequently! Please visit the class web site as often as possible. Textbooks Textbook: “Data Structures and Algorithms in C++”, Thomson Learning 2000, Adam Drozdek (清华影印) References: 1.“Data structures with C++ Using STL”, William Ford, William Topp, Prentice-Hall, 2nd Edition, 2002 (清华) 2.《数据结构》(C语言版),严蔚敏、吴伟民,清华大学出版社,1996 Pre-requisite: Basic Knowledge in C/C++, Discrete Mathematics Visual C++.net, Borland C++ Builder Office Hours Regular Office Hou

文档评论(0)

1亿VIP精品文档

相关文档