Data Abstraction and Object-Oriented Programming in C++ 在线电子书 图书标签:
发表于2024-08-25
Data Abstraction and Object-Oriented Programming in C++ 在线电子书 pdf 下载 txt下载 epub 下载 mobi 下载 2024
Data abstraction and object-oriented programming together represent a style of program- ming that offers opportunities for improved software productivity. While other modemprogramming techniques like modular programming are similarly motivated, they often areused in concert with conventional procedural programming. They tend to emphasize waysto overcome particular problems with widely used programming practices, and thus offerincremental improvements to the art of computer programming. Because of its close asso-ciation with object-oriented programming, we discuss data abstractiotr--the use of abstractdata types--in considerable detail in this book. As we shall see, data abstraction similarlyoffers substantial benefits when used with conventional programming styles. More impor-tant, though, is the value of data abstraction as a necessary stepping stone to object-orientedprogramming. Object-oriented programming, with data abstraction as a necessary founda-tion, differs greatly from other programming styles and methodologies in that it requires adifferent way of thinking, in essence, a different approach to problem solving using com-purrs. Our first task in this chapter is to present a bird's eye view of data abstraction andobject-oriented programming and to specify their place in computer programming. Next,we will look at the similarities and differences between C++ and C, then turn to the newfeatures of C++ and how they aid data abstraction and object-oriented programming. In thisintrocluetion, we will neither define the vocabulary nor treat the details of our subjects butwill concentrate of a summary exposition of these topics.1.1 DATA ABSTRACTIONProgrammers have long recognized the value of organizing related data items in programconstructs like Pascal RECORDS or C structs, and then treating the resulting data struc-tures as units. Data abstraction extends this organization to encompass a set of operationsthat can be performed on a particular instance of the structure. Usually, the data elementsand the implementation of the operations that can be performed on them are hem privateor encapsulated to prevent unwanted alteration. Instead of accessing data elements directly,user code, often called client programs, must invoke the permissible operations to achieveresults. To do this, clients have access to a client interface or specification by which theycan know how to invoke the operations. When we encapsulate data structures and their operations in this way, we can make thembehave analogously to the built-in or fundamental data types like integers and floating pointnumbers. We can then use them simply as black boxes which provide a transformation be-tween input and outpuL We need not understand or even be aware of their inner workings,just as we do not need to know exactly how a compiler treats a fundamental data type. Data
评分
评分
评分
评分
Data Abstraction and Object-Oriented Programming in C++ 在线电子书 pdf 下载 txt下载 epub 下载 mobi 下载 2024