Let's Look at C++

ccwell11

ccaldwell11

Posted on February 5, 2024

Let's Look at C++

What is C++?

C++ is an object-oriented programming language that was developed by Danish scientist, Bjarne Stroustrup. Stroustrup created this extension of the C language to support objects and classes (a feature that the C programming language lacks). C++ is a powerful language that has many useful capabilities and support libraries that make it a top contender for high-performance software development.

Due to C++'s main base being sourced from the C language, the two languages are almost entirely compatible with each other. C++ is also compatible with other languages with shared origins or similar syntactical structures. Allowing developers to have manual control over memory is another feature of C++ that is another feature the language has that sets it apart from others. The most desirable feature of C++, however, is its object-oriented programming (OOP) model. OOP is the use of objects and classes to structure code in a way that allows code to be reusable. Although the use of objects and classes are heavily utilized in the JavaScript language as well, there are still a few differences that set them apart.

C++ vs JavaScript

C++ was developed for the purpose of handling high-performance applications while allowing access to memory and certain system properties. JavaScript was created to help developers create webpages and incorporate interactive elements into them. Another major difference between the languages is that C++ is a compiled language, one that will run unless the program is converted into "machine language". JS is an already interpreted language which means that it gets passed through an interpreter that reads and runs the program line by line.

Difference between compiler and interpretor

Advantages

The key advantages of C++ may not be extremely obvious at first glance, but they are extremely useful for many coding tasks:

  • Object-oriented allows for better factorization of similar code blocks

    • Helps with efficiency, readability, and code manipulation
  • Precise memory control

  • Large library support to assist with repetitive programming tasks

Disadvantages

The few disadvantages that set JS and C++ apart will ultimately decide which language is best for your project:

  • Manual memory access can be more hazardous or inconveniencing due to the sensitivity of the data and the ease of causing unexpected manipulations

Visualization of memory in C++

Where is it used?

C++ is used in a multitude of things due to its widespread capabilities as a language. Some technologies as important as space rovers and items we interact with every day include them as well. Below are a few more places where C++ is commonly used:

  • Video games

  • Operating systems

  • Package Managers & Build Systems

Syntax Introduction to C++

/*Library header - allows certain functions to be performed 
in C++. This one allows for inputs and outputs to be used.*/
#include <iostream> 

/*This is the 'standard library' being declared 
to allow access to named variables*/
using namespace std;

int main() { //Main function declaration
  cout << "Hello World!"; //"Hello World" output using cout
  return 0; //Function must have a return
} //End of function
Enter fullscreen mode Exit fullscreen mode

Conclusion

The language created by Bjarne Stroustrup known as C++, is a very useful language for advanced and high-performance software and applications. With it being a highly compatible language and using objects to maximize runtime efficiency, C++ is undoubtedly a valuable tool for the older and new generations of developers alike.

💖 💪 🙅 🚩
ccwell11
ccaldwell11

Posted on February 5, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

What was your win this week?
weeklyretro What was your win this week?

November 29, 2024

Where GitOps Meets ClickOps
devops Where GitOps Meets ClickOps

November 29, 2024