Page Content

Tutorials

Introduction To C++, History And Characteristics?

Introduction to C++

Bjarne Stroustrup created C++, a general-purpose programming language, as an extension of C that added the object-oriented paradigm. Since its first introduction in 1979, this high-level programming language has grown to serve as the basis for numerous contemporary technologies, including operating systems, web browsers, game engines, financial systems, and more. Free-form, case-sensitive, statically-typed, compiled, general-purpose C++. It supports generic, object-oriented, and procedural programming. It is a middle-level language since it combines low- and high-level components.

Key characteristics

Among the important traits and skills are:

  • It is capable of supporting data abstraction.
  • With the ability to define lightweight abstractions, it offers a straightforward and effective hardware model.
  • It makes direct memory access possible.
  • Among its high-level features are the ability to override operators and create new kinds (classes).
  • Functional programming with function objects and lambda expressions, and generic programming with templates, are examples of new or improved features in the current C++ standards (C++11, C++14/17/20).
  • Many different application domains use it extensively, but applications that need speed and/or access to low-level capabilities are especially fond of it. Scientific computation, financial systems, gaming development, device drivers, operating system interfaces, system programming, and challenging embedded systems projects are a few examples.
  • It is made to write high-quality code.
  • Source text is compiled into object files for a C++ program, which are subsequently joined by a linker to create an executable program. Preprocessing is a step in this process that comes before compilation.

History of C++

History of C++
History of C++

Beginning in 1979 at Bell Labs (AT&T, USA) in Murray Hill, New Jersey, Bjarne Stroustrup invented C++. Originally, it was a way to improve the C programming language. It was originally known as “C with Classes”. With reference to the C increment operator, the “++” denotes the evolutionary character of the improvements from C, and the name was renamed to C++ in 1983.

C++ was created in response to the requirement to handle growing program complexity. Some of the object-oriented elements of C++ were influenced by Simula67, according to Stroustrup. Public/private access control, constructors, destructors, classes, derived classes, and function declarations with argument checking were among the early features. By 1984, references, virtual functions, and function and operator overloading had been acquired. Later iterations incorporated exceptions and templates.

The first steps towards standardising C++ were taken in 1989 by an ANSI Committee. This attempt sought to avoid disparate dialects by developing a single description of the language. WG21, a standardisation initiative started by the International Organisation for Standardisation. In 1998, the initial ISO C++ standard (ISO/IEC 14882) was authorised. This is frequently known as C++98. The language has been modified and expanded to by C++11, C++14, C++17, and C++20, as well as a 2003 “bug fix” release.

Relationship to C

C-based C++. The assumption that C++ is a superset of C makes most legal C programs also legal C++ programs. C was the basis for C++, an object-oriented programming language. International Standard for C++ is based on ANSI/ISO C.

When employing object-oriented and generic programming, C++ programs may differ from C programs, despite sharing syntax and essential characteristics.

These are some significant facets of their relationship and differences:

Shared Core: The built-in types (char, int, float, double, and void), operators (arithmetic, relational, logical, and bitwise), control structures (if, switch, for, while, and do-while), pointers, arrays, structures (struct), unions, and functions may all be found in C++.

Syntax: For C pointer arithmetic, memory address assignment, and pointer variable declaration, C++ employs the same syntax as C. Frequently, C++ statements are the same as C ones.

C Standard Library: The library for C is incorporated into the C++ library. Included in the C++ standard library with modified names (cstdio, cstring, cctype, cstdlib) are the headers from the C library (such as stdio.h, string.h, ctype.h, and stdlib.h). In contrast to their.h counterparts, the names declared in these cname headers are usually located within the std namespace. You can use functions from the C standard library in C++ programs.

Object-Oriented Features: Classes (which share syntactic similarities with C’s struct but also include member functions and access control), inheritance, polymorphism (typically via virtual functions), constructors, and destructors are some of the new features that C++ brought. These are important differentiators and the foundation of C++ object-oriented programming.

Other Language Features: C++ brought new features like operator overloading (which gives operators for user-defined types new meanings), function overloading (which permits multiple functions with the same name but different parameters), references, namespaces (which prevents name collisions), exception handling, and templates (for generic programming).

Type System Differences: C++ introduced built-in types bool and wchar_t, while C utilised typedefs for notions that were similar. Character constants have type int in C, whereas they have type char in C++. In C, comparison operators return int; in C++, they return bool. Types in the statically typed language C++ are checked during compilation.

Memory Management: In contrast to C, which employs malloc and free library functions, C++ added new and delete operators for dynamic memory allocation. In C++, the dynamic allocation functions of C (malloc, free) remain accessible.

I/O Systems: An object-oriented input/output system based on streams and classes (iostream, fstream, and stringstream) is defined in C++. Although C-style I/O functions (such as printf, scanf, and others that require cstdio) can still be used for compatibility, new code often prefers the C++ I/O system.

Interfacing with C Code: Functions compiled with a C compiler can be called with C++’s linking standards, which use extern “C”. When combining C and C++ code, this is quite important. To conditionally include code unique to the C++ compilation, use the preprocessor macro __cplusplus.

Style: Unlike C programmers, C++ programmers frequently prioritise distinct features and styles. Certain capabilities of C, such as C I/O and certain preprocessor applications, are less frequently utilised in contemporary C++ style.

A C program may not always be a legitimate C++ program, and certain features (such as character constants and global variable declarations) work slightly differently, even though C++ is essentially a superset.

Agarapu Geetha
Agarapu Geetha
My name is Agarapu Geetha, a B.Com graduate with a strong passion for technology and innovation. I work as a content writer at Govindhtech, where I dedicate myself to exploring and publishing the latest updates in the world of tech.
Index