• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            天行健 君子當自強而不息

            C++, An Overview

            There are two primary aspects to the programs we write

            1. A collection of algorithms (that is, the programmed instructions to solve a particular task)

            2. A collection of data against which the algorithms are run to provide each unique solution

            These two primary program aspects, algorithms and data, have remained invariant throughout the short history of computing. What has evolved is the relationship between them. This relationship is spoken of as a programming paradigm.

            In the procedural programming paradigm, a problem is directly modeled by a set of algorithms. A check-out/check-in system for loan materials of a public library, such as books, videos, and so on, is represented as a series of procedures, the two central procedures being the checking-out and checking-in of library materials. The data is stored separately, accessed either at a global location or by being passed into the procedures. Three prominent procedural languages are FORTRAN, C, and Pascal. C++ also supports procedural programming. Individual procedures, such as check_in(), check_out(), overdue(), fine(), and so on, are referred to as functions. Part III, Procedural-Based Programming, focuses on the support C++ provides for the procedural programming paradigm, with an emphasis on functions, function templates, and generic algorithms.

            In the 1970s, the focus of program design shifted from the procedural paradigm to that of abstract data types (now generally referred to as object-based programming). In this paradigm, a problem is modeled by a set of data abstractions. In C++ we refer to these abstractions as classes. Our library check-out system, for example, under this paradigm is represented as the interaction between object instances of classes such as Book, Borrower, DueDate (an aspect of Time), and the inevitable Fine (an aspect of Money), representing the library abstractions. The algorithms associated with each class are referred to as the class's public interface. The data is privately stored within each object; access of the data is hidden from the general program. Three programming languages that support the abstract data type paradigm are CLU, Ada, and Modula-2. Part IV, Object-Based Programming, illustrates and discusses the support C++ provides for the abstract data type programming paradigm.

            Object-oriented programming extends abstract data types through the mechanisms of inheritance (a "reuse" of an existing implementation) and dynamic binding (a reuse of an existing public interface). Special type/subtype relationships between previously independent types are now provided. A book, videotape, recording, and children's puppet are each a kind of library material, although each has its own check-out and check-in policy. The shared public interface and private data are placed in an abstract LibraryMaterial class. Each specific library material class inherits the shared behavior from the LibraryMaterial abstract class and need provide only the algorithms and data that support its behavior. Three prominent languages supporting the object-oriented paradigm are Simula, Smalltalk, and Java. Part V, Object-Oriented Programming, focuses on the support C++ provides for the object-oriented programming paradigm.

            C++ is a multiparadigm language. Although we think of it primarily as an object-oriented language, it also provides support for procedural and object-based programming. The benefit is that we are able to provide a solution best suited to the problem ?in practice, no one paradigm represents a best solution to every problem. The drawback is that it makes for a larger and more complicated language.

            In Part I, we present a quick tour of the entire C++ language. One reason for this is to provide a first introduction to the language features so that we can more freely reference aspects of the language before we fully treat them. For example, we don't look at classes in detail until Chapter 13, but if we waited until then to mention classes we would end up presenting a great many unrepresentative and largely irrelevant program examples.

            A second reason for providing a breadth-first tour of the language is aesthetic. Unless you are exposed to the beauty and complexity of a Beethoven sonata or the exhilaration of a Scott Joplin rag, it is easy to become alternately impatient and bored with the apparent irrelevant detail of sharps, flats, octaves, and chords; but until those details are mastered, making music remains largely beyond our means. Much the same holds true with programming. Stepping through the maze of operator precedence or rules governing the standard arithmetic conversions is a necessary but necessarily tedious foundation to mastering programming in C++.

            Chapter 1 provides a first introduction to the basic elements of the language: the built-in data types, variables, expressions, statements, and functions. It looks at a minimum legal C++ program, discusses the process of compiling our programs, briefly walks through the preprocessor, and takes a first look at support for input and output. It presents a number of simple but complete C++ programs that the reader is encouraged to compile and execute.

            In Chapter 2, we walk through a procedural program, an object-based program, and then an object-oriented program implementation of an array ?that is, a numbered collection of elements of the same type. We then compare our array abstraction with the C++ standard library vector class and take a first look at the standard library generic algorithms. Along the way, we motivate and take a first peek at C++'s support for exception handling, templates, and namespaces. In effect, the entire language is introduced, although many of the details are deferred until later in the text.

            Some readers may find portions of Chapter 2 rough going. Material is presented without the full explanation normally expected of a primer (the explanation is provided in subsequent chapters). If you should find yourself feeling overwhelmed or impatient at the level of detail, we recommend that you skim through or skip that portion, returning to it later when the material is more familiar. In Chapter 3, we begin the more traditional narrative pace, and the reader uncomfortable with Chapter 2 is recommended to start there.

            posted on 2007-10-17 19:43 lovedday 閱讀(839) 評論(0)  編輯 收藏 引用 所屬分類: ▲ C++ Primer

            公告

            導航

            統計

            常用鏈接

            隨筆分類(178)

            3D游戲編程相關鏈接

            搜索

            最新評論

            怡红院日本一道日本久久| 久久综合久久美利坚合众国| 亚洲AV无一区二区三区久久| 久久亚洲AV无码精品色午夜麻豆 | 亚洲天堂久久久| 久久精品国产亚洲AV电影| 国产一区二区精品久久岳| 四虎影视久久久免费观看| 日韩人妻无码精品久久免费一| 亚洲狠狠婷婷综合久久蜜芽| 久久久久久国产精品无码下载| 亚洲AV日韩精品久久久久久| 久久综合狠狠色综合伊人| 色综合久久久久无码专区| 无夜精品久久久久久| 亚洲综合久久综合激情久久| 亚洲精品国精品久久99热一| 伊人久久大香线蕉成人| 久久天天躁狠狠躁夜夜av浪潮 | 久久久人妻精品无码一区| 94久久国产乱子伦精品免费| 国产99久久精品一区二区| 久久精品中文字幕无码绿巨人| 亚洲级αV无码毛片久久精品| 18岁日韩内射颜射午夜久久成人| 久久亚洲av无码精品浪潮| 一级做a爰片久久毛片看看| 精品人妻伦一二三区久久| 久久强奷乱码老熟女| 香蕉久久夜色精品国产2020| 伊人久久精品影院| 99久久国产亚洲高清观看2024 | 久久综合九色综合网站| 狠狠色噜噜色狠狠狠综合久久| 青青草原精品99久久精品66| 久久精品国产亚洲麻豆| 亚洲精品乱码久久久久久蜜桃不卡| 亚洲国产一成人久久精品| 亚洲国产精品一区二区三区久久 | 狠狠88综合久久久久综合网| 国内精品伊人久久久久影院对白 |