c-plus-plus
  1. c-plus-plus-history

C++ Tutorial History

Introduction

C++ is a high-level, object-oriented programming language that was developed in 1983 by Bjarne Stroustrup, a Danish computer scientist. C++ was initially developed as an extension to the C programming language, with the addition of new features such as object-oriented programming, inheritance, encapsulation, polymorphism, among others. The language is widely used for developing operating systems, embedded systems, games, and applications.

Syntax

The syntax of C++ is similar to that of the C language, with some additional features. Here is a basic syntax example:

#include <iostream>

using namespace std;

int main() {
   cout << "Hello, World!";
   return 0;
}

Explanation

  • #include <iostream>: This line includes the iostream library, which allows input/output operations to be performed.
  • using namespace std;: This line allows you to use the standard namespace, which contains many commonly used functions and objects.
  • int main() { }: This is the main function of the program; it is where the execution of the program begins.
  • cout << "Hello, World!";: This line outputs the message "Hello, World!" to the standard output (usually the console).

Example

Here is another example that demonstrates some of the key features of C++:

#include<iostream>

using namespace std;

class Shape 
{
   public:
      virtual void draw() 
      {
         cout << "Drawing a Shape" << endl;
      }
};

class Circle: public Shape 
{
   public:
      void draw() 
      {
         cout << "Drawing a Circle" << endl;
      }
};

int main() 
{
   Shape *ptrShape = new Circle();
   ptrShape->draw(); 
   
   return 0;
}

Output

Drawing a Circle

Use

C++ is widely used for developing various types of applications, including operating systems, system software, embedded systems, games, and applications. It is popular for its performance and efficiency, as well as its support for object-oriented programming.

Important Points

  • C++ was initially developed as an extension to the C programming language.
  • C++ supports basic concepts like inheritance, encapsulation, polymorphism, and more.
  • C++ is widely used for developing operating systems, embedded systems, games, and applications.

Summary

This tutorial provided an overview of the history of C++ and its syntax, features, and uses. C++ is a powerful and versatile programming language that has been used to develop many important applications and systems. It is a popular choice among programmers who require a high level of performance and efficiency in their code.

Published on: