Contents I. Introduction II. Programming in C++: Basic Concepts III. Scope of Reference in C and C++ IV. Overloading Functions and Operators in C++ V. Functions within C++ Data Structures VI. Classes in C++ VII. Declaring a Class in C++ VIII. Inheritance and Polymorphism IX.
Conclusion X. I would like to tell about programming in C++. If C is the language most associated with UNIX, C++ is the language that underlies most graphical user interfaces available today. C++ was originally developed by Dr. Bjarne Stroustrup at the Computer Science Research Center of AT&T's Bell
Laboratories (Murray Hill, New Jersey), also the source of UNIX itself. Dr. Stroustrup's original goal was to create an object-oriented simulation language. The availability of C compilers for many hardware architectures convinced him to design the language as an extension of C, allowing a preprocessor to translate C++ programs into C for compilation. After the C language was standardized by a joint committee of the
American National Standards Institute (ANSI) and the International Standards Organization (ISO) in 1989, a new joint committee began the effort to formalize C++ as well. This effort has produced several new features and refined significantly the interpretation of other language features, but it has not yet resulted in a formal language standard. Programming in C++: Basic Concepts C++ is an object-oriented extension to
C. Because C++ is a superset of C, C++ compilers compile C programs correctly, and you can write non-object-oriented code in the language. The distinction between an object-oriented language and a procedural one can be subtle and hard to grasp, especially with regard to C++, which retains all of C's characteristics and concepts. One way to get at the difference is to say that when programmers code
in procedural language they specify actions that do things to data, whereas when they write object-oriented code, they create data objects that can be requested to perform actions on or with regard to themselves. Thus, a C function receives one or more values as input, transforms or acts upon those values in some way, and returns a result. If the values that are passed include pointers, the contents of data variables may be modified by the function. As the Standard Library routines show, it is likely that the code calling
a function will not know, nor need to know, what steps the function takes when it is invoked. However, such matters as the data type of the input parameters and the result code are specified when the function is defined and remain invariable throughout program execution. Functions are associated with C++ objects as well. But as you will see, the actions performed when an object's function is invoked may automatically differ,
perhaps substantially, depending on the specific type of the data structure with which it is associated. This aspect is known as overloading of function names. Overloading is related to a second characteristic of C++, namely the fact that functions can be defined as belonging to C++ data structures one aspect of the wider language feature known as encapsulation.
In addition to overloading and encapsulation, object-oriented languages also allow you to define new abstract data types (including associated functions) and then derive subsequent data types from them. The notion of a new class of data objects, in addition to the built-in classes such as integer, floating point number, and character, goes beyond the familiar ability to define complex data objects in C. Just as a C data structure that includes, say, an integer element inherits the properties and functions
applicable to integers, so too a C++ class that is derived from another class inherits the class' functions and properties. When a specific variable or structure (instance) of that class' type is defined, the class is said to be instantiated.
! |
Как писать рефераты Практические рекомендации по написанию студенческих рефератов. |
! | План реферата Краткий список разделов, отражающий структура и порядок работы над будующим рефератом. |
! | Введение реферата Вводная часть работы, в которой отражается цель и обозначается список задач. |
! | Заключение реферата В заключении подводятся итоги, описывается была ли достигнута поставленная цель, каковы результаты. |
! | Оформление рефератов Методические рекомендации по грамотному оформлению работы по ГОСТ. |
→ | Виды рефератов Какими бывают рефераты по своему назначению и структуре. |