tailieunhanh - C 2.0 practical guide for programmers PHẦN 2
Trong thực tế, có một số tác vụ mà bạn chỉ có thể làm bằng cách sử dụng ngôn ngữ lắp ráp. Trong khi đó là sự thật rằng ngôn ngữ Pascal là có khả năng, đủ để xử lý ngắt, nó không thể được sử dụng để vượt qua đầu vào bàn phím để DOS, ví dụ. | ter 2 chap Classes Objects and Namespaces Software development is a non-trivial activity even simple software systems have inherent complexity. To tackle this complexity two paradigms have dominated the software development landscape. The first and older paradigm is based on the notion of procedural abstraction and divides developmental work into two distinct parts. First real-world entities are identified and mapped as structures or records data and second subprograms are written to act upon this data behavior . The primary drawback of the procedural approach is the separation of data and behavior. Because data may be shared among several subprograms using global variables or parameters responsibility for its behavior is scattered and open ended. For this reason applications using the procedural approach can be difficult to test debug and maintain. The second paradigm otherwise known as the object-oriented approach is based on the notion of data abstraction and divides developmental work into two very different tasks. First the data and behavior of each real-world entity of the problem domain are identified and encapsulated into a single structure called a class. Second objects created from the different classes work together to provide a solution to the given problem. Importantly each object is ideally responsible for the behavior of its own data. The C programming language is based on the object-oriented paradigm. This chapter therefore begins with a discussion on classes and objects. It describes how objects are created based on classes and how access to data and methods is controlled. It also covers how classes are logically grouped into namespaces. The last two sections describe the composition of a compilation unit and how a C program is implemented compiled and executed as a collection of compilation units. 9 10 Chapter 2 Classes Objects and Namespaces Classes and Objects A class is an abstraction that represents the common data and behavior of a .
đang nạp các trang xem trước