“C++ is Desperate to be Object-Oriented”

The title is a quote by a friend of mine.  We were having a discussion about different programming languages and their respective advantages.  We got into the topic of object-oriented languages.  She mentioned her fondness for Java and C#.  I mentioned C++, because it was the language emphasized by my CS courses.  It was after all an object-oriented language, or so I thought.  My friend scoffed and bluntly replied “C++ is desperate to be Object-oriented”.

For those of you not familiar with the concept of Object-Oriented Programming(OOP), it is a programming paradigm based on the concept of “objects”, which are structures containing data is the form of attributes and methods(procedures). The methods are able to access and modify the data fields of the objects.  The most popular type of OOP is class-based programming where objected inherit from their respective classes which determine their data type.Object-oriented Programming can be contrasted with Procedural Programming, where procedural calls are carried out through a series of computational steps.  Languages which utilizes this method of programming include C, Fotran, Pascal and BASIC.  Many of these languages are considered by some to be outdated as they have been replaced by Java, C#, Objective C and maybe even Apple’s newest language, Swift!!

My friend made the argument that C++ is not a pure object-oriented language…and she’s right! C++ is actually a multi-paradigm programming language.  This means it has elements of both object-oriented and procedural programming.  Of course, I could list multiple “object-oriented” languages that are actually multi-paradigm.  These include Object Pascal, VB.NET, C# and Java.  Of course, most Java fanatics will retort that C++ cannot be considered “object-oriented” because you can actually define certain functions outside of the class.  However, I would argue that Java allows certain members to be used without objects and it utilizes primitive data types.

It seems like a lot of programming geeks have their own definition of object-oriented which they use to boost the superiority of their preferred programming language.  However, the standard definition of object-oriented programming (as written in CS textbooks include the following): Data Encapsulation, Dynamic Binding, Polymorphism, and Inheritance.  If a programming language includes all of that, it is considered to be object-oriented even if it has other elements.
C++ fits the criteria.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s