![C程序設(shè)計教學(xué)課件:CHAPTER 1 Object-Oriented Programming_第1頁](http://file4.renrendoc.com/view/58f6e1ad6c451e4087dee391d70298a1/58f6e1ad6c451e4087dee391d70298a11.gif)
![C程序設(shè)計教學(xué)課件:CHAPTER 1 Object-Oriented Programming_第2頁](http://file4.renrendoc.com/view/58f6e1ad6c451e4087dee391d70298a1/58f6e1ad6c451e4087dee391d70298a12.gif)
![C程序設(shè)計教學(xué)課件:CHAPTER 1 Object-Oriented Programming_第3頁](http://file4.renrendoc.com/view/58f6e1ad6c451e4087dee391d70298a1/58f6e1ad6c451e4087dee391d70298a13.gif)
![C程序設(shè)計教學(xué)課件:CHAPTER 1 Object-Oriented Programming_第4頁](http://file4.renrendoc.com/view/58f6e1ad6c451e4087dee391d70298a1/58f6e1ad6c451e4087dee391d70298a14.gif)
![C程序設(shè)計教學(xué)課件:CHAPTER 1 Object-Oriented Programming_第5頁](http://file4.renrendoc.com/view/58f6e1ad6c451e4087dee391d70298a1/58f6e1ad6c451e4087dee391d70298a15.gif)
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
1、C+ Programming CHAPTER 1 Object-Oriented Programming 11.1 Introduction1.2 Object-Oriented and Procedural Programming 1.3 Classes and Abstract Data Types1.4 The Client/Server Model and Message Passing1.5 Inheritance and Polymorphism1.6 Interfaces and Components21.1 IntroductionProgramming LanguagesTh
2、e genesis of the computer revolution was in a machine. The genesis of our programming languages thus tends to look like that machine. 31.1 Introduction1 Machine Language: Binary instruction, which is also called an instruction system, is the only one used directly by computers.Example:Addition 10010
3、1 Subtraction 01001141.1 Introduction2 Assembly Language: The assembler language is a kind of symbolic language. It adopted some mnemonic symbols which can show the instructional functions to present the content of the program. Example:Addition add Subtraction sub51.1 Introduction3 High-level langua
4、ge: It is a programming language based on English. Its operators and expressions are similar to ordinary mathematical formulas.Example: int a,b,c,d; a=10; b=5; c=8; d = a + b c; FORTRAN,BASIC,PASCAL,C61.1 Introduction4 Object-oriented programming languages: They have three characteristics in common:
5、 encapsulation, polymorphism and inheritance.Example: Smalltalk,LISP,C+,Java,C#;71.1 IntroductionAlgorithmsAlgorithms are methods for solving problems which are suited for computer implementation.81.1 IntroductionData StructureData structure is the type and organization of data in a program.91.2 Obj
6、ect-Oriented and Procedural Programming Procedural ProgrammingProcedural programming is associated with a design technique known as top-down design. In top-down design, a problem is associated with a procedure. Example: C, Pascal.101.2 Object-Oriented and Procedural Programming Object-Oriented Progr
7、ammingObject-oriented programming is an alternative to procedural programming. The design technique associated with object-oriented programming is object-oriented design. In an object-oriented program, the modules are classes rather than procedures.111.2 Object-Oriented and Procedural Programming Ar
8、istotle was probably the first to begin a careful study of the concept of type; he spoke of “the class of fishes and the class of birds.”In object-oriented design, a class is a collection of objects.121.2 Object-Oriented and Procedural Programming Objects in a class share properties, features, or at
9、tributes. For example, if Human is a user-defined data type in C+, we can define a variable such as maryLeakey to represent the object who belongs to the class of human beings. Just like:Human maryLeakey; 131.2 Object-Oriented and Procedural Programming In C+, the member variables or fields are call
10、ed data members. The functions that belong to a class are called function members. In object-oriented languages generally, such functions are called methods.141.3 Classes and Abstract Data TypesInformation HidingIn an object-oriented language, a class is a module that supports information hiding. In
11、 a C+ class, we can use keywords such as public and private to control access to the classs properties and operations. 151.3 Classes and Abstract Data TypesEncapsulationIn procedural programming, data are manipulated by procedures with passing arguments to and returning a value from a function. 161.
12、3 Classes and Abstract Data TypesIn object-oriented programming, data and the procedures to manipulate the data can be encapsulated or contained within a class. 171.3 Classes and Abstract Data TypesAbstract Data TypeA data type is abstract if it exposes in its public interface only high-level operat
13、ions and hides all low-level implementation details. For example, the classes in C+, which provide information hiding, are abstract data types.181.4 The Client/Server Model and Message PassingClient/Server ModelObject-oriented programming is based on client/server model of computing. This model expl
14、ains the emphasis placed on information hiding in object-oriented programming. 191.4 The Client/Server Model and Message PassingExample:#include using namespace std;int main()string s1=”Hello World!”; int n=s1.length(); return 0;The C+ program that uses the string class is a client. A client request
15、s services from a string object by invoking one of its methods, which is characterized as sending a message to the object.201.4 The Client/Server Model and Message PassingMessage Passing #include using namespace std;int main()string s1=”Hello World!”; int n=s1.length(); return 0;211.4 The Client/Ser
16、ver Model and Message PassingData membersFuction membersFuction membersobjectData membersFuction membersFuction membersobjectData membersFuction membersFuction membersobjectmessagemessagemessage221.5 Inheritance and PolymorphismClasses can be stand-alone or they can occur in inheritance hierarchies,
17、 which consist of parent/child relationships among classes.parrentchild 231.5 Inheritance and PolymorphismInheritanceOne of the most compelling features about C+ is code reuse. Inheritance supports a form of code reuse.241.5 Inheritance and PolymorphismPolymorphismThe term polymorphism means having
18、many forms. Polymorphism allows improved code organization and readability as well as the creation of extensible programs that can be “grown” not only during the original creation of the project, but also when new features are desired.251.6 Interfaces and ComponentsInterfacesInterfaces, if well built and shared among classes, are a convenience to programmers. Learning a shared inter
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 【正版授權(quán)】 ISO 21952:2025 EN Welding consumables - Wire electrodes,wires,rods and deposits for gas shielded arc welding of creep-resisting steels - Classification
- 2025年度環(huán)保設(shè)備購置貸款合同范本
- 2025年度合肥工業(yè)學(xué)校食堂承包經(jīng)營權(quán)轉(zhuǎn)讓合同書
- 2025年度智能倉儲供應(yīng)鏈服務(wù)合同
- 2025年度公路貨運(yùn)保險合同標(biāo)的協(xié)議
- 邯鄲2024年河北邯鄲館陶縣選聘農(nóng)村黨務(wù)(村務(wù))工作者90人筆試歷年參考題庫附帶答案詳解
- 菏澤2024年山東菏澤東明縣文化和旅游局引進(jìn)急需緊缺人才3人筆試歷年參考題庫附帶答案詳解
- 福建2025年福建省醫(yī)學(xué)科學(xué)研究院招聘衛(wèi)生健康政策研究高層次人才筆試歷年參考題庫附帶答案詳解
- 白山2025年吉林白山市縣事業(yè)單位招聘應(yīng)征入伍高校畢業(yè)生14人筆試歷年參考題庫附帶答案詳解
- 漯河2024年河南漯河市委黨校(漯河行政學(xué)院漯河市社會主義學(xué)院)招聘2人筆試歷年參考題庫附帶答案詳解
- 新版藥品管理法培訓(xùn)完整版本課件
- 醫(yī)院信息系統(tǒng)HIS知識培訓(xùn)教學(xué)課件-HIS的主要內(nèi)容
- 硝苯地平控釋片
- 合成聚氨酯原料及助劑生產(chǎn)項目
- 四川省瀘州市2019年中考物理考試真題與答案解析
- 部編版語文六年級下冊全套單元基礎(chǔ)??紲y試卷含答案
- 2023年保險養(yǎng)老地產(chǎn)行業(yè)分析報告
- 保險公司防火應(yīng)急預(yù)案
- 動物檢疫技術(shù)-動物檢疫的分類(動物防疫與檢疫技術(shù))
- 2024醫(yī)師資格考試考生誠信考試承諾書
- 煤礦職業(yè)衛(wèi)生培訓(xùn)課件2023
評論
0/150
提交評論