ВУЗ:
Составители:
Рубрика:
35
С with Classes
By adding classes to C, the resultant language – «C with classes» – could offer
better support for encapsulation and information hiding. A class provides a distinct
separation between its internal implementation (the part that is more likely to change)
and its external interface. A class object has a determinate state right from its
construction, and it bundles together the data and operations that manipulate it.
Enter C++
In 1983, several modifications and extensions had already been made to С with
classes. In that year, the name «C++» was coined. Ever since then, the + + suffix has
become a synonym for object-orientation. (Bjarne Stroustrup could have made a
fortune only by registering ++ as a trademark). It was also in that year that C++ was
first used outside AT&T Labs. The number of users was doubling every few months
– and so was the number of compilers and extensions to the language.
C++ as Opposed to Othe r Obje ct-Oriented Languages
C++ differs from other object-oriented languages in many ways. For instance,
C++ is not a root-based language, nor does it operate on a runtime virtual machine.
These differences significantly broaden the domains in which C++ can be used.
Backward Compatibility with Legacy Systems
The fact that legacy С code can be combined seamlessly with new C++ code is a
major advantage. Migration from С to C++ does not force you to throw away good,
functional С code. Many commercial frameworks, and even some components of the
Standard Library itself, are built upon legacy С code that is wrapped in an object-
oriented interface.
Object-Orientation and Other Useful Paradigms
In addition to object-oriented programming, C++ supports other useful
programming styles, including procedural programming, object-based programming,
and generic programming – making it a multi-paradigm, general-purpose
programming language.
Procedural Programming
Procedural programming is not very popular these days. However, there are
some good reasons for C++ to support this style of programming, even today.
Gradual Migration of С Programmers To C++
С programmers who make their first steps in C++ are not forced to throw all
their expertise away. Many primitives and fundamental concepts of C++ were
inherited from C, including built-in operators and fundamental types, pointers, the
notion of dynamic memory allocation, header files, preprocessor, and so on. As a
Страницы
- « первая
- ‹ предыдущая
- …
- 34
- 35
- 36
- 37
- 38
- …
- следующая ›
- последняя »