Saturday, April 23, 2016

Things different about C++ than other languages especially variations of C


Hello World,

Today I am going to try a different approach to how I have been doing the previous blog posts. Rather than focusing solely on making a program to test out how to implement a specific feature of the language, I am going to talk about C++ in general. For instance, there so many different languages that exist. Not only that, there are many different languages that are different variations of C++. Some of these variations include C, C#, and Objective C. In addition to stating why C++ exists, I shall state two interesting parts of the language that sets it apart especially from these different variations.

I have already stated in a previous post that the language was created by Bjarne Stroustrup. He created C++ from a variation of the language C. The difference between them was that C did not implement object orientation. C++ does. C is a language that produces fast runtime so this was a concept that Stroustrup wished to keep.

In short, one reason why C++ is used so much is because of its transferability between other interpreters and other libraries. C++ is such a common language that it can be accessed easily by other development applications. One quote I found online basically sums up my point. “You rarely find a big program written all in one language, or without using libraries, so easy integration with other languages and libraries was a key design goal.” (www.cantrip.org).

One very great thing you can do in C++ that sets it apart from other languages especially C is the creation of objects. I already stated that object orientation was a main reason C++ was created. There is a function in this language that takes it one step further. Objects can be created by declaring a template. One nice feature about templates is that they relate back to efficiency. For example, imagine creating an array that swaps placement of values every time the user enters new data. Rather than having multiple places for the same code to be written, you could just declare a template or an object to hold all the specified information. Then the user can keep recycling that one line of template when they need to. For reference look at the picture below.


This idea of creating these easy to use objects or templates is not strictly limited to just C++. Java as well as other object oriented languages also has the functionality of making templates however it is quicker to do in C++. If one were to make a template in Java, they could not simply just declare template and be done. They would need to make a class for the object template, reference that object in a different class, then apply some sort of data to that object. Basically the image below sums up the concept.




Although C++ is not very different from other languages especially object oriented languages, there are important features that differentiate it from others. Some of these features include templates and also the transferability of code from different applications and programs. By this I mean that C++ code is not too far off from some of the other major programming languages. Thus doing a program in C++ is mostly easily adjustable when tried in a different language.

I hope you enjoyed this post and please let me know if you have any questions.

Also sometime within the next week, I will be doing another post on a bigger programming task to do in C++. I will post some suggestions soon, but if you happen to have any ideas for programs that are at the intermediate level, please let me know.


Thanks!!!


No comments:

Post a Comment