C++ is stated to be a programming language used for the general purpose of precisely defining operational processes that a computer will perform. Much of the operations that computers perform are based on data manipulation for the purpose of data sharing. While these are the conventional ways in which C++ is used within the computer arena, practically anything can be programmed using this programming language. Bjarne Stroustrup created the programming language in 1979 and it has since become one of the most prevalent languages among many within the IT sector. The structure of C++ is primarily based on the C language. C programming language, which is referred to as one of the most widely used languages of all time. Languages such as C#, D, Limbo, Java, JavaScript, PHP, and Python have all been derived from the C language. The C++ language was expressly designed by Stroustrup to be compatible with C. While easier than most programming languages, C++ is quite a multifaceted and complex one with its concepts that must be definitively understood before executing any type of operational aspect of it.
A particular type of programming language, C++ was created in 1979 by Bjarne Stroustrup. Originally referred to as C with Classes, this particular programming language is considered one of the most popular and is frequently implemented in many operating platforms. C++ has a significant influence on everything from application software, software testing, to video game software and in other programming languages such as Java. Discourse on C++ is vast and voluminous. This paper will explain some of the concepts of C++ including classes, objects as instantiations of classes, abstraction, encapsulation, inheritance, templates, and containers and analyze the C programming language items and how they frame and relate the objected oriented programming components into classes, objects, interfaces, templates, and containers.
Much of the success of C++ can be attributed to the fact that it provides programmers the opportunity to both process and organize information more efficiently than other types of programming languages. C++ also builds on work that has already been started with C language. Stroustrup (2000) noted that C++ was derived from the programming language of C with a few exceptions. The programming language of C++ maintained much of C as a subset. This was to ensure that there was a close correspondence between the various operators, statements, types, and objects that computers often deal with. The basis for a programming language is to serve two specific purposes: as an outline for a programmer to identify actions that need to be executed and a type of concept set that a programmer can utilize when considering what must be done in that particular execution. The rationale behind C being chose as the base language for C++ was "because it [was] (1) versatile, terse and relatively low-level; (2) [was] adequate for most systems programming tasks; (3) runs everywhere and on everything and (4) fits into the UNIX programming environment" (pg. 13). Essentially, Stroustrup suggested that "the better one knows C, the harder it seems to be to avoid C++" (pg.14). Since, most programs that use C language, these can be transformed into programs that utilize C++ with minimal hassle. Classes are defined as a type of data structure concept. Classes can contain functions and data. Classes are commonly noted utilizing keywords and are presented in a certain type of format. Classes are identified by the class_name for the specific class. An object is a class instantiation. When examining the conceptualization of variables, an object would be a variable and a class would be considered a type of variable. The definition of instantiation is a realization of a certain type of abstraction. Instantiation then is a form of creation. Classes give objects their particular blueprint, thereby, the statement can be made that objects are created from classes. Objects of a certain class are noted with the same type of declaration as variable types. (Oualline, 1997; Horstmann and Budd, 2008).
Every C++ program is composed of two components that include program data, which is the information pertaining to the program which can be affected by functions of that said program and the codes, or program statements, which perform the various actions. These are referred to as functions. When discussing the definition of encapsulation, this joins together both the data and functions through data manipulation. Encapsulation in C++ has also led to the conceptualization known as data hiding. Encapsulation is essentially data bundling. The mechanics of abstraction are to both hiding the details of data implementation from the user and expose the interfaces only. C++ has the ability to support encapsulation through the classes ("The C++ Programming Language," 2013). The power of object-oriented languages such as C++ comes from the fact that these languages specifically support class hierarchies. The old class is referred to as the base class or parent class and hence, the new class is considered the child class or subclass. Any class can be denoted as a subclass of another class known as a superclass. Every subclass represents what is known as a superclass specialization. If a programmer creates a certain object that is an instance of a class, the object is also an instance of other classes within that hierarchy (Bronson, 2011).
Classes can limit access to definite member functions and variables through the use of access specifiers by way of the inheritance process. C++ effectively executes the inheritance process through what is known as derivation. Derivation allows code to be reused in order for new classes to be created. There are different forms of inheritance including single inheritance and multiple inheritances. Inheritance permits subclasses to inherit the various properties of the respective parent classes ("Inheritance (C++ only)," 2013). Single inheritance is "a common form of inheritance [where] classes have only one base class. A common attribute in most class hierarchies is that the derived class has a kind of relationship with the base class" ("Single Inheritance," 2012). Stroustrup (1999) identified that multiple inheritances permit the user to combine concepts that are independent as classes into a concept composite represented as a class that has been derived. Multiple inheritances are commonly used when the program designer wants to "provide sets of base classes with the intention that a user creates new classes by choosing base classes from each of the relevant sets" (pg.2). There are features to C++ programming such as containers and templates.
A container is an object that has the capability of storing a collection of other objects. Containers are typically implemented as templates of classes. "The container manages the storage space for its elements and provides member functions to access them, either directly or through iterators. Containers replicate structures very commonly used in programming: dynamic arrays, queues, stacks, heaps, linked list, trees [as well as] associative arrays. Many containers have several member functions in common, and share functionalities" ("Containers," 2013). C++ requires users to declare the functions, variables and other types of precise entities. Because many of the codes look the same for a variety of types, if a user were to execute certain algorithms or data structures such as linked lists, the code would look analogous irrespective of the type being used. Thus, templates are the resolution to this problem. They are specific classes and/or functions that are created for one or more types that have not been identified or specified. When a template is used, types are unequivocally or “implicitly passed as arguments.” Each code within the standard C++ library is a template code usually. When broken down into types, there are two kinds of templates: class templates and function templates. A class template allows for classes to be generated on certain parameters. These are commonly utilized to employ the aforementioned containers. The C++ library contains several class templates. A function template acts similar to a function with subtle differences such as being able to have arguments of different types. A common format of function templates is noted as: template <class identifier> function_declaration; template <typename identifier> function_ declaration (Vandevoorde and Josuttis, 2002).
Object-Oriented Programming is diverse and stands alone from procedural languages such as C in that everything within the structure of OOP is grouped as objects. Stroustrup (1995) sought to define object-oriented programming by stating that anything object-oriented must "(1) not be a mere synonym for good; (2) not exclude most accepted meanings; (3) have a firm historical basis [and] (4) exclude something" (pg.2). When examining the various concepts within the C++ language, Stroustrup (1995) further stated that a language is only object-oriented if it supports directly "abstraction, inheritance, [and] run time polymorphism" (pg.2). Therefore, the concepts of abstraction and inheritance are object-oriented in that abstraction provides the vital information that is needed without exposing the various details of that information and based on the definition of inheritance within the C++ language provides a useful dynamic to code reusability by allowing the size of the codes to be reduced.
C++ polymorphism is defined as "a call to a member function [that] will cause a different function to be executed depending on the type of object that invokes that function" ("The C++ Programming Language," 2013). For the purposes of object-oriented programming, polymorphism provides different meanings to certain functions of the specific language that is being discussed. Classes related to object-oriented programming in that classes are the blueprint for an object. Thus, when defining the connotation of a class, understanding what operations can be performed within an object is the result of the structuring of the class. Encapsulation relates to object-oriented programming in that encapsulation places both the functions as well as the data in the same place. Stroustrup (2000) defined within the advice sections the specifics of what he meant when giving advice to the C++ programmers. Stroustrup stated that concepts should be represented as classes, that one should create a function as "a member-only if it needs direct access to the representation of a class, use a namespace to make the association between a class and its helper functions explicit, [and] use public data only when it is really just data" (pg.257). Hence, much of the framework of objects, interfaces, templates, and containers is based on classes per that statement.
C++ continues to be one of the most well-known programming languages. While complex and intricately designed, many computer programmers have stated that it is one of the easier languages to learn. As with all programming language, what is needed is persistence to understand and incorporate the various aspects of the language into one's IT understanding. Simply put, there is practically no computer produced and manufactured that probably does not utilize C++. The programming language is that widespread.
(Code example omitted for preview. Available via download)
References
Bronson, G. J. (2011). A First Book of C++. Stamford, CT: Cengage Learning.
C++ > Data Structures sample source codes. (2013). Retrieved August 31, 2013, from Happy Codings website: http://cplusplus.happycodings.com/Data_Structures/code4.html
The C++ Programming Language. (2013). Retrieved August 24, 2013, from tutorialspoint website: http://www.tutorialspoint.com/cplusplus/
Containers. (2013). Retrieved August 26, 2013, from cplusplus.com website: http://www.cplusplus.com/reference/stl/
Horstmann, C. S., & Budd, T. A. (2008). Big C++. Hoboken, NJ: Wiley.
Inheritance (C++ only). (2013). Retrieved August 26, 2013, from IBM website: http://publib.boulder.ibm.com/infocenter/cellcomp/v101v121/index.jsp? topic=/com.ibm.xlcpp101.cell.doc/language_ref/inher.html
Oualline, S. (1995). Practical C++ Programming. Sebastopol, CA: O'Reilly & Associates, Inc.
Single Inheritance. (2012). Retrieved August 24, 2013, from Microsoft website: http://msdn.microsoft.com/en-us/library/84eaw35x.aspx
Stroustrup, B. (2000). The C++ Programming Language. London, UK: Addison Wesley.
Stroustrup, B. (1999). Multiple Inheritance for C++ [Article]. Retrieved from The Pennsylvania State University website: http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.23.4735
Stroustrup, B. (1995). Why C++ is not just an Object-Oriented Programming Language. Retrieved August 27, 2013, from Bjarne Stroustrup website: http://www.stroustrup.com/oopsla.pdf
Vandevoorde, D., & Josuttis, N. M. (2002). C++ Templates: The Complete Guide. London, UK: Addison Wesley.
Capital Punishment and Vigilantism: A Historical Comparison
Pancreatic Cancer in the United States
The Long-term Effects of Environmental Toxicity
Audism: Occurrences within the Deaf Community
DSS Models in the Airline Industry
The Porter Diamond: A Study of the Silicon Valley
The Studied Microeconomics of Converting Farmland from Conventional to Organic Production
© 2024 WRITERTOOLS