An In-Depth Analysis of Object-Oriented Programming (OOP) Concepts

Verified

Added on  2023/06/07

|11
|1451
|340
Homework Assignment
AI Summary
This paper provides an overview of Object-Oriented Programming (OOP), explaining its core concepts: inheritance, encapsulation, and polymorphism. Inheritance is described as the ability of a child class to inherit properties from a parent class, with examples demonstrating single, multiple, multilevel, hierarchical, and hybrid inheritance. Encapsulation, the process of wrapping data within a single unit, is discussed in terms of data security, flexibility, and reusability, with a code example illustrating its implementation. Polymorphism, the ability of a program to display messages in different forms, is explained with real-life analogies and examples of functional overloading and function overriding. The paper emphasizes the importance of these OOP features in modern programming languages like Java and C++, highlighting their role in simplifying and securing code development.
Document Page
Running head: OBJECT ORIENTED PROGRAMING
Object Oriented Programing
Name of the Student
Name of the University
Author Note
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
1OBJECT ORIENTED PROGRAMING
Table of Contents
Introduction....................................................................................................................3
Object Oriented Programing..........................................................................................3
Encapsulation:................................................................................................................5
Polymorphism................................................................................................................7
Conclusion....................................................................................................................10
Document Page
2OBJECT ORIENTED PROGRAMING
Introduction:
The OOPs or the object oriented programing can be explained as the programing
model language that is organised around the actions and the data rather than the logical
programing. This make the OOPs one of the best and most efficient programing language
(Zakas 2015). The concept of the OOPs have made programing much simple and very much
efficient in terms of coding. Some of the most important features of OOPs programing are –
inheritance, abstraction, and polymorphism. These parts will be further described in the
paper.
Object Oriented Programing
Inheritance Programing- The concept of the inheritance is one of the most important feature
of the object oriented programing. The inheritance property defines that the child class can
inherit the properties of the parent class. This is one of the most interesting feature of the
OOPs concept that helps in the property of the inheriting data from the different classes.
Inheritance can be sub divided into 5 different sections. Namely the single inheritance,
multiple inheritance, multiple inheritance, hierarchical inheritance, Hybrid inheritance
(Bracha and Ungar 2015). The single inheritance is when a single class inherits the
properties of the single parent class. The multiple inheritance can be explained as when a
child class inherits the properties of the 2 or more parent classes. The multilevel inheritance
provides the concept of the class which is extracted from another class and further that class
being derived from another class. That is class c derived from class B and the Class B is
derived from class A. IN hierarchical inheritance two child class are derived from a single
parent class.
Document Page
3OBJECT ORIENTED PROGRAMING
Further an example of the inheritance program code is presented the paper with the
results.
(Figure 1: inheritance)
(Source: Author)
class Teacher1 {
String designation = "Teacher1";
String college = "Beginners";
void does(){
System.out.println("Teaching");
}
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
4OBJECT ORIENTED PROGRAMING
}
public class MathTeacher extends Teacher1{
String mainSubject = "Maths";
public static void main(String args[]){
MathTeacher1 obj = new MathTeacher1();
System.out.println(obj.college);
System.out.println(obj.designation);
System.out.println(obj.mainSubject);
obj.does();
}
}
Encapsulation:
Data encapsulation is one of the other major feature of the OOPs programing. IT can
be defined as the process of wrapping up the data under a single unit or a single class (Team
2015). That it is explained as the mechanism for the process of the binding the data together
and using it further. Encapsulation helps in the property of the data security. It keeps the data
in a single class and the other classless cannot access the data hence creating a safe
environment for the data in that class. That is it helps in the process of the data hiding. One of
the other major feature of the process of the data encapsulation is the data flexibility (Nagar
2018). That is when a data is specified under one section it helps in the property using the
Document Page
5OBJECT ORIENTED PROGRAMING
data in a flexible manner. One of the other major feature of this is the reusability of the data
(Milanesi 2018). Hence this can be said that the data encapsulation is the process in which the
helps the data keeping secured. It have helped me to ensure that all the data in the program
Further there is program which explains the data encapsulation property of the process.
(Figure 2: Encapsulation)
(Source: Author)
class EmployeCount
{
private int numOfEmployees = 0;
public void setNoOfEmployees (int count)
{
numOfEmployees = count;
}
Document Page
6OBJECT ORIENTED PROGRAMING
public double getNoOfEmployees ()
{
return numOfEmployees;
}
}
public class EncapsulationExample
{
public static void main(String args[])
{
EmployeCount obj = new EmployeCount ();
obj.setNoOfEmployees(513);
System.out.println("Total Employees: "+(int)obj.getNoOfEmployees());
}
}
Polymorphism
Polymorphism is one of the other major feature of the Oops programing. In simple
words the process of the polymorphism can be explained as the ability of program to display
messages. Using real life example the concept of the polymorphism can be explained as let us
suppose a man in single time can be father, brother and son that is possess different
chacteristic at the same time (Kelly 2016). This is the property of the polymorphism. There
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
7OBJECT ORIENTED PROGRAMING
are two kinds of the polymorphism are functional overloading, and the function overriding
(Dennis, Wixom and Tegarden 2015). These two are the main problems of the services of the
problems and hence ensuring the properties and the services and solutions for a program to
run (Corral et al. 2014). It has to be ensured that every entity and class can be inherited.
(Figure 3: Polymorphism)
(Source: Author)
public class Tiger extends Animal{
...
public void animalSound(){
System.out.println("Roar");
}
Document Page
8OBJECT ORIENTED PROGRAMING
}
public class Tiger extends Animal{
...
@Override
public void animalSound(){
System.out.println("Roar");
}
}
public class Cat extends Animal{
...
@Override
public void animalSound(){
System.out.println("MEao");
}
}
Further the object oriented pogromming is one of the easiest thing that is to be
considered and hence needs to ensure proper security in the paper and properties of the
system. The object oriented programs are easy to be executed and hence the programs are
making are easy. Further the process of the programing language like the JAVA provides
some of the other major properties helping in the process of the programing language and
Document Page
9OBJECT ORIENTED PROGRAMING
hence ensuring proper programing is made. The use of the properties like the encapsulation,
inheritance and polymorphism have helped a lot in order to ensure that there is right process
of the coding.
Conclusion:
Thus concluding the topic it can be said that the property of inheritance, encapsulation
and the polymorphism is some of the most important feature of the object oriented program
that helps in the process of the coding. Thus also makes the process of the object oriented
programing easy to understand. Further the encapsulation property ensures that the data in the
classes are secured. The concept of the object oriented programing can be implemented in
Java, C++ and other programing languages.
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
10OBJECT ORIENTED PROGRAMING
References
Bracha, G. and Ungar, D., 2015. OOPSLA 2004: mirrors: design principles for meta-level
facilities of object-oriented programming languages. ACM SIGPLAN Notices, 50(8), pp.35-
48.
Corral, J.M.R., Balcells, A.C., Estévez, A.M., Moreno, G.J. and Ramos, M.J.F., 2014. A
game-based approach to the teaching of object-oriented programming languages. Computers
& Education, 73, pp.83-92.
Dennis, A., Wixom, B.H. and Tegarden, D., 2015. Systems analysis and design: An object-
oriented approach with UML. John wiley & sons.
Kelly, S., 2016. Object-Oriented Programming. In BlitzMax for Absolute Beginners (pp. 101-
114). Apress, Berkeley, CA.
Milanesi, C., 2018. Object-Oriented Programming. In Beginning Rust (pp. 273-294). Apress,
Berkeley, CA.
Nagar, S., 2018. Object-Oriented Programming. In Introduction to Python for Engineers and
Scientists (pp. 207-230). Apress, Berkeley, CA.
Team, S., 2015. Object-Oriented Programming.
Zakas, N.C., 2015. Object‐Oriented Programming. Professional Javascript® for Web
Developers, pp.173-216.
chevron_up_icon
1 out of 11
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]