StudentShare
Contact Us
Sign In / Sign Up for FREE
Search
Go to advanced search...
Free

Concepts of C++ Object Oriented Programming - Report Example

Cite this document
Summary
This report "Concepts of C+ Object Oriented Programming" discusses the standard library in C+ that includes two types of containers that are sequences and associative containers. The sequences types of containers are like the vector except if mentioned otherwise…
Download full paper File format: .doc, available for editing
GRAB THE BEST PAPER93.2% of users find it useful
Concepts of C++ Object Oriented Programming
Read Text Preview

Extract of sample "Concepts of C++ Object Oriented Programming"

?Running head: Technical Paper C++ Topic:  Technical Paper: es and Hierarchies in C++ Table ofContents Running head: Technical Paper C++ 1 Table of Contents 2 Concepts of C++ Object Oriented Programming 3 Abstraction 3 Abstract Data Types 4 Class 4 Object 5 Inheritance 6 Encapsulation 7 Templates 8 Containers 9 References 9 Concepts of C++ Object Oriented Programming Bijarne Stroustrup developed the object oriented programming language C++ by incorporating the concepts of object orientation, inspired by the Simula programming language, in to the C programming language (Stroustrup, 1991). Stroustrup added object oriented items like classes and other enhancements to create C++. These items of Bijarne Stroustrup are explained in detail in this paper. Abstraction The first step to follow in developing a program related to a problem is to create a model or an abstract view of that problem by separating the necessary information from the unnecessary details. This procedure is known as abstraction, with which a model is developed out of a given problem. This signifies that the abstract model concentrates on the stuff related to the given problem as it defines the properties of the problem under consideration. These properties constitute: The affected data corresponding to the problem. The identified operations corresponding to the problem. (Stroustrup, 1989) As for instance, you have been asked to develop a program for administering the employees in an institution. The basic information required for this would commence with the questions: What employee information is necessary for the program? This may include various properties characterizing each employee such as name, social number, D.O.B., etc. What functionalities should be incorporated in to the program? In short, abstraction is basically defined as the process in which a complex problem is structured in to well-defined entities through defining their data and operations (Stroustrup, 1988). Subsequently, these entities and their data and operations serve as a single unit which cannot be decoupled. Abstract Data Types Abstraction results in the formation of well-defined entities for the sake of proper management. These entities further characterize the data structure for a combination of items. As for instance, each employee in the ‘employee administration program’, mentioned in the previous example, has name, social number and D.O.B. Only the defined operations will be able to access the data structure. These defined operations are referred as the interface, which are exported by the entity. An abstract data types (ADTs) denote an entity that holds all these properties. A necessary feature of object oriented programming (OOP) languages, such as C++, is to allow the implementation of ADTs (Cargill, 1986). Thus, the ADTs constitute the fundamental concept for object orientation. Some scholars have even defined OOP as the programming ADTs and their relationships. Subsequently, a particular representation of ADT is attained after its implementation. Class A class actually denotes an abstract data type. Hence, it provides the details for the implementation of the desired data structure and operations. So, let’s construct our very own class of abstract data type Integer: class Integer { //attributes: int i //methods: setValue(int n) Integer addValue(Integer j) } The above code denotes the definition of a class. Two sections, namely: attributes and methods, in the above example, define how to implement the data structure and operations related to the abstract data type. These two different elements are differentiated through two levels. Attributes that define the data structure at the abstract data type level, are required at the implementation level. Similarly, the methods which subject to the implementation of abstract data type operations are also defined at the implementation level. The data structure, in the above example, comprises of just one element that is a signed sequence of digits. The relative attribute is a normal integer type of a programming language. Only two methods addValue() and setValue() are used in the above example, which define two operations set and add. A class is basically used to implement the ADT. It further includes the attributes and the methods that are defined and employed for implementing the data structure and operations of an abstract data type, in the respective order (Ford and Topp, 1996). Objects are defined as the instances of classes. Subsequently, classes are also used to represent the properties as well as behavior of the sets of objects. Object We have previously discussed about the instances of the abstract employees in the above stated employee example. Since these instances actually are the examples of an ADT employee, therefore, they include real values that denote a specific employee. There instances are referred as objects in the object oriented programming environment. Each object can be identified uniquely by its name. Hence, there could be two distinct objects having the same set of values. The set of values of an object at a specific time is referred as the state of that object. The bottom line is that an object can be defined as an instance of a class that can be easily distinguished or recognized by its unique name. An object defines a state that is denoted by the values of its attributes at a specific time. An object changes its state in accordance to the methods applied to it (Goldberg Robson, 1983). The possible sequence of these changes in the object-state is referred as the behavior of the object. Hence, the set of methods applied on an object characterize the behavior of that object. So far, we have discussed two basic concepts of object orientation in C++, namely: class and object. Hence, OOP is defined as the implementation of ADTs or simply, as the writing of classes. At the time of execution, the instances of these classes called the objects attain the objective of the program through changing their states (Koenig, 1995). Subsequently, a running program can be characterized as a collection of objects. Inheritance The use of classes in OOP provides an effective approach to organize objects, particularly because of the reusability feature of the classes which implies that classes are extensible (Shopiro, 1987). Hence, new classes can be formed by extending the existing classes, which are referred as the descendents of the parent classes from which they have been created. These descendent classes have the ability to inherit all the attributes or to overrule the inappropriate attributes of the parent class. A lot of work and precious time can be saved by employing this concept of object oriented programming since only new features are required to be added to the descendent class while it inherits the entire functionality of the parent class (Nygaard, 1986). In C++, inheritance signifies that classes can be created driving their attributes from the previously developed classes or we can also say that a new class can be formed that adopts all the data and functions of an existing class. The original class from which the new class is derived is referred as the base class, parent class ancestor or super class whereas the derived class is referred as sub class, child class or descendant. Inheritance is essential for a programming language to be truly object oriented in nature. One of the greatest advantages of inheritance is that an important portion of the required code for the class has already been created and tested. In order to derive a class, the syntax to be followed is: class sub-class: class-access-specifier parent-class { class definition statements }; (Stroustrup, 1987). where class is the keyword for employing inheritance in C++, sub-class is the name of the derived class, class access specifier defines the scope of the class by using the keyword: public, private or protected, parent class is the name of the base class from which the new class is being derived. Although all members of the parent class are incorporated in to the object created from the sub-class, however, functions of the sub-class cannot access the private members of the parent class. The ‘private’ access specifier indicates that the private data and functions are accessible only within a class whereas the ‘protected’ access specifier signifies that the protected data and functions are accessible only by the class functions or by sub-class functions and the ‘public’ access specifier implies that the accessibility of the data and functions is not confined. Encapsulation Procedures or modules serve as autonomous mini programs comparatively. The modular routines include their own instructions as well as their own variables. These instructions and variables are encapsulated that is they are hidden and contained within a module due to which the module becomes independent of other modules and thereby, it can be reused. Encapsulation reduces time and effort while increasing reliability on the other hand. Sometimes programmers consider encapsulation as an example of employing the ‘black box’ that is a device in which you don’t know how it works but still you are able to use it. Similarly, when you use a class in your program then you are basically using a group name without knowing anything about the individual component since the details are encapsulated or hidden. Templates C++ allows you to create functions with the help of using variable types. Such function templates act as an outline for a combination of functions, which are different in relation to their types of parameters. A combination of functions that are created from the same template is usually referred as a family of functions. At minimum, one parameter is parameterized or generic in a function template signifying that one parameter can accept any number of C++ types. Sometimes the programmers interchangeably use the terms ‘template function’ and ‘function template’. Actually, first a function template is created and then it produces one or more template functions. The syntax for writing a template in C++ is stated below: template T function(T employee-salary) { return employee-salary; } where template is the keyword for creating a function template, T refers to any type either simple or defined by the programmer. The above code is an example of a function template that takes a value ‘employee salary’ and returns that value. Containers The standard library in C++ includes two types of containers that are sequences and associative containers. The sequences types of containers are like the vector except if mentioned otherwise. The types and functions included in a vector can also be employed for any other container and generate the same result. Moreover, the associative containers offer element access on the basis of keys. Hence, the examples of containers are: built-in arrays, valarrays, strings, and bitsets since they can hold elements. But still these types of standard containers are not developed completely. As for instance, a built-in array is unable to hold its own size and stay compatible with C arrays in relation to the layout. Standard containers are supposed to be interchangeable logically wherever required. Then the user is able to select between them on the basis of the efficiency issues and the requirement of specialized operations. References Stroustrup, B. (1991). The C++ Programming Language. US: Addison- Wesley. Stroustrup, B. (1987). Multiple Inheritance for C + +. Proceedings of the Spring’87 EUUG Conference. Helsinki. Stroustrup, B. (1989). The Evolution of C + +: 1985-1989. USENIX Computer Systems, Vo.l 2, No. 3. Stroustrup, B. (1988). Possible Directions for C + +: 1985-1987. Proc. USENIX C + + Workshop, Santa Fe. Cargill, T.A. (1986). PI: A Case Study in Object-Oriented Programming. SIGPLAN Notices, pp. 350-360. Ford,W. and Topp, W. (1996). Data Structures with C++. US: Prentice-Hall Inc. Goldberg, A. and Robson, D. (1983). Smalltalk-80: The Language and its Implementation. US: Addison-Wesley. Koenig A. (1995). Draft Proposed International Standard for Information Systems – Programming Language C++. ANSI Standards Secretariat. CBEMA, 1250 Eye Street NW, Suite 200, Washington DC20005, USA. Nygaard, K. (1986). Basic Concepts in Object Oriented Programming. SIGPLAN Notices, pp. 128-132. Shopiro, J. (1987) Extending the C + + Task System for Real-Time Applications. Proc. USENIX C + + Workshop, Santa Fe. Read More
Cite this document
  • APA
  • MLA
  • CHICAGO
(Concepts of C Object Oriented Programming Report Example | Topics and Well Written Essays - 1750 words, n.d.)
Concepts of C Object Oriented Programming Report Example | Topics and Well Written Essays - 1750 words. https://studentshare.org/logic-programming/1456340-technical-paper-classes-and-class-hierarchies-in-c
(Concepts of C Object Oriented Programming Report Example | Topics and Well Written Essays - 1750 Words)
Concepts of C Object Oriented Programming Report Example | Topics and Well Written Essays - 1750 Words. https://studentshare.org/logic-programming/1456340-technical-paper-classes-and-class-hierarchies-in-c.
“Concepts of C Object Oriented Programming Report Example | Topics and Well Written Essays - 1750 Words”. https://studentshare.org/logic-programming/1456340-technical-paper-classes-and-class-hierarchies-in-c.
  • Cited: 0 times

CHECK THESE SAMPLES OF Concepts of C++ Object Oriented Programming

Object Oriented Programming

Traditionally, a computer program was seen as a collection of functions or procedures or simply a list of instructions whereas with the advent of object oriented programming, each program may be seen as comprising a collection of individual units, or objects, that act on each other.... OOP is an acronym for object oriented programming.... Traditionally, a computer program was seen as a collection of functions or procedures or simply a list of instructions whereas with the advent of object oriented programming, each program may be seen as comprising a collection of individual units, or objects, that act on each other....
4 Pages (1000 words) Essay

Object oriented development

The fundamental concepts of OOP (short for object oriented programming) are class, object, encapsulation, inheritance, abstraction, and polymorphism.... Mainly influenced by C++ and the popularity of GUI (Graphical User Interface), Object-oriented programming became the most sought after programming method to date.... The objective behind object-oriented programming is to view computer programs as a collection of individual units or objects that is capable of receiving messages, processing data, and sending messages to each other....
5 Pages (1250 words) Essay

Computer Programming: The Advantages of Object Oriented Programming

The author also analyzes the statement that 'to operate' a computer is far easier, yet less powerful, than 'to program' a computer and discusses the advantages of object-oriented programming.... As it is figured out the total cost of investments of taking expertise and effective knowledge of c-sharp computer programming training would be small enough in comparison to how much we pay for studying law or medicine in college.... hellip; An entry-level programming job is preferred by the students, new graduates, and part-time workers....
6 Pages (1500 words) Assignment

Procedural programming languages and object oriented programming language

Procedural programming is simply an approach to programming and the… However it should be noted that it is possible to write an object oriented code using a procedural language like turbo C, similarly it Procedural programming languages and object oriented programming language Introduction: Object oriented languages and procedural programming languages are basically two different paradigms based on two different thought processes.... Procedural programming is simply an approach to programming and the languages that support this methodology are called procedural programming languages, as is the case with object oriented programming languages....
2 Pages (500 words) Essay

Object Oriented Programming

There are two paradigms that are followed to write computer programs: ‘procedural' or of the of the of the object oriented programming INTRODUCTION A Computer Program is a series of instructions that tells a computer what tasks it needs to perform and in what sequence.... The three main principles that lie at the core of object oriented programming are encapsulation, inheritance and polymorphism.... EXAMPLESPractical present day examples of Object oriented languages are narrated by Emden and Somoson (2006) as: “Pizza and GJava are examples of Multi-Paradigm object oriented programming Languages....
1 Pages (250 words) Research Paper

Object-Oriented System Engineering

Thus the end product of the above process using object oriented approach would be the most reliable software application which runs on low production/maintenance cost.... s compared to procedural or structured programming in which we define a solution to a problem as a set of procedures or actions that can be performed in order to accomplish the task, the object-orientated approach solves a problem by considering each entity involved in the problem as real-world objects....
9 Pages (2250 words) Report

Object Oriented Programing Languages

This report "Object Oriented Programing Languages" discusses object-oriented programming languages that are dominant in terms of programming languages.... The system which was effectively divided into a number of compositional subsystems was not very effective thus creating the need to formulate object-oriented programming languages such as C++, C#, PHP, Python, Java, Perl, Ruby etcetera (Budd, 2008).... As a result, object-oriented programming has led to programs that are easier to understand, easier to maintain, and most importantly, adaptable to evolution (Clark, 2013)....
15 Pages (3750 words) Report

Object-Oriented Programming Paradigm

The paper "Object-oriented programming Paradigm" will begin with the statement that class is a description of the behaviors of an object.... It's an atom of object-oriented programming that covers the state and the behavior of data processing systems.... Property: Properties in most of the objected oriented programming languages are found between member data and member code of a class.... Role: Role in the programming field represents the functionality of an object....
11 Pages (2750 words) Assignment
sponsored ads
We use cookies to create the best experience for you. Keep on browsing if you are OK with that, or find out how to manage cookies.
Contact Us