Part I: The Basics
Every programming language provides common features ?
- Built-in types such as integers, characters, and so forth
- Variables, which let us give names to the objects we use
- Expressions and statements to manipulate values of these types
- Control structures, such as if or while, that allow us to conditionally or
repeatedly execute a set of actions - Functions that let us define callable units of computation
- But hey differ in detail from one language to another.
Most programming languages supplement these basic features in which two ways ?
- They let programmers extend the language by defining their own types/data structure, and they provide
library routines that define useful functions and types not otherwise built into the
language.
C++ Types features ?
-
the type of an object determines what operations can be performed on it. Some languages, such as Smalltalk and Python, check types at run time. In contrast, C++ is a statically typed language; type
checking is done at compile time. As a consequence, the compiler must know the type of every name used in the program. -
C++ provides a set of built-in types, operators to manipulate those types, and a small set of statements for program flow control. These elements form an alphabet from which we can write large, complicated, real-world systems. At this basic level, C++ is a simple language.
-
Its expressive power arises from its support for mechanisms that allow the programmer to define new data structures/types (mostly the class. sometimes we calle “class types” to distinguish them from the built-in type. C++, allow programmers to define types/class types that include operations as well as data.The Standard C++ library uses these features to implement a rich library of class types and associated functions.).
Why c++ supports mechanisms that allow the programmer to define new data structures.?
- Using these facilities, programmers can shape the language to their own purposes without the
language designers having to anticipate the programmers’ needs.