home comics writing pictures archive about

2018-04-24 - C++

C++ started out as an extension to C that soon developed into its own unique language. While C is simple yet powerful C++ is complex yet very powerful. C++ is an object oriented language which means that the language is focused around creating classes consisting of attributes and actions. These classes are used as schematics for creating instances of those classes called objects. The attributes provide information about the object and the actions define what the object can do. C++ also includes a vast standard library that provide classes for many common tasks.

C++ has grown over the years and tries to meet the needs of many different scenarios. The many features of C++ are one of its greatest strengths and also one of its greatest weaknesses. In C++ there are usually multiple ways to do the same thing and it's not always clear why one should be preferred over the others. In C the only way to cast a value from one type to another was to enclose the desired type in parenthesises before the value. In C++ you can do casts the C way which is discouraged or you can use the new dynamic_cast, static_cast, reinterpret_cast and const_cast operators. All of these different casts are meant for specific types of conversions. The problem is that now you have to think about your specific scenario in order to determine the best one to use.

C++ is by no means a bad language. It is simply a language that requires you to be very aware of what you are doing which might be the biggest thing it inherited from C. Instead of trying to provide a singular preferred path it instead went for many possible paths each meant for a different situation. Probably the best indicator of the importance of C++ is the number of languages that came after it. You can see the influences of C++ in the syntax and style of many modern object oriented languages. 

Although C++ can be frustrating to use at time it's hard to give up the many tools it provides to you.

Comments: