Question

In: Computer Science

OOP involves use of the following concepts: inheritance, polymorphism, and encapsulation. What are your definitions of...

  1. OOP involves use of the following concepts: inheritance, polymorphism, and encapsulation. What are your definitions of these terms? Why are they important? Does a program necessarily suffer if one or more of these items are absent?

Solutions

Expert Solution

Encapsulation can be defined as the mechanism which takes care of :

  • Binding the data with the functionalities that manipulates it.
  • It keeps the data and the code safe from external interference

Inheritance is the mechanism by which an object acquires the some/all properties of another object. For example, a child inherits some properties of parents. Hence, this is an example of inheritance.

Polymorphism means objects have different meanings based on their data type.

In other words it means that one method with multiple implementation, for a certain class of action. And which implementation to be used is decided at runtime depending upon the situation (i.e., data type of the object).

They are important because we can relate to real work applications using these concepts. With the help of encapsulation, we can  keep classes separated and prevent them from having tightly coupled with each other. Polymorphism allows us to have multiple methods with same signatures but with different functionalities. Inheritance provides reusability of code.

No, a program need not suffer if one or more of these items are absent.


Related Solutions

Which Feature of OOP illustrates code reusability? Abstraction, Encapsulation, Inheritance, Polymorphism or All of them.
Which Feature of OOP illustrates code reusability? Abstraction, Encapsulation, Inheritance, Polymorphism or All of them.
Inheritance - Polymorphism One advantage of using subclasses is the ability to use polymorphism. The idea...
Inheritance - Polymorphism One advantage of using subclasses is the ability to use polymorphism. The idea behind polymorphism is that several different types of objects can have the same methods, and be treated in the same way. For example, have a look at the code we’ve included for this problem. We’ve defined Shape as an abstract base class. It doesn’t provide any functionality by itself, but it does supply an interface (in the form of .area() and .vertices() methods) which...
Software Engineering Fundamentals: Classification (Grouping) Abstraction (Representing) Inheritance (Generalizing) Encapsulation (Modularizing) Association (Relating) Polymorphism (Executing) Understanding...
Software Engineering Fundamentals: Classification (Grouping) Abstraction (Representing) Inheritance (Generalizing) Encapsulation (Modularizing) Association (Relating) Polymorphism (Executing) Understanding and applying these fundamentals is crucial to great program design. Please describe, in your own words, any two out of the above 6 fundamentals. The answer must include practical examples (you are welcome to demonstrate your understanding by drawing a UML diagram, writing a small piece of pseudo-code, and/or writing a small piece of real code). Please describe each of the fundamentals you selected...
Write a simple short Java program of your choice which illustrates inheritance, polymorphism and the use...
Write a simple short Java program of your choice which illustrates inheritance, polymorphism and the use of interfaces. The program should not take up more than half a page of size A4.
This question demonstrates the use of inheritance and polymorphism. Design a Ship class that has the...
This question demonstrates the use of inheritance and polymorphism. Design a Ship class that has the following members: • A field for the name of the ship (a string). • A field for the year that the ship was built (a string). • A constructor and appropriate accessors and mutators. • A toString method that overrides the toString method in the Object class. The Ship class toString method should display the ship’s name and the year it was built. Design...
Create a game of your choice that involves the following concepts:
C++ PROJECTCreate a game of your choice that involves the following concepts:STL library. (Maps, Sets, Lists, Stacks and Queues), with Iterators and AlgorithmsShow especially Especially Algorithm/Iterators/Containers in the STLMinimum of 750 linesInclude Full documentation
What is different between procedural and object-oriented programming? Match each of the following OOP concepts with...
What is different between procedural and object-oriented programming? Match each of the following OOP concepts with its example/description. Question 2 options: 12345678 Providing a way for an entity to behave in several ways OR providing multiple entities to be treated in a similar way 12345678 A key way of saving having to retype a lot of code for similar but different objects 12345678 The removal of non-essential information 12345678 Allowing which function to be called by an object to be...
Visual Studio C# Create an application illustrating the following: Class definition Encapsulation Constructor Instantiation Inheritance Suggestions:...
Visual Studio C# Create an application illustrating the following: Class definition Encapsulation Constructor Instantiation Inheritance Suggestions: Simulation Calculation Interface apps
Use the following terms to complete the following public health concepts/definitions: Rye Syndrome Double blind Germany...
Use the following terms to complete the following public health concepts/definitions: Rye Syndrome Double blind Germany Relative risk Syphilis Endemic rate Decades Heart Disease Statists Cause Perspective Shoe leather epidemiology Risk Factors Reporting bias Tuskegee Syphilis Study Epidemiology Crude Risk perception Randomized Women’s Health Initiative 1. The ______ is the usual and expected rate of frequency of a disease. 2. An epidemiologic investigation requires asking the who, where, and when questions. This kind of medical detective work is nicknamed ____________...
Inheritance - What is inheritance - Answer your own description in Readme.txt Based on Hamburger project,...
Inheritance - What is inheritance - Answer your own description in Readme.txt Based on Hamburger project, you will create a package about Pizza. In your Readme.txt, write how you make your Pizza package differently from the Hamburger package and also explain how inheritance work with your Pizza package. package Hamburger; /** * Inheritance challenge – Hamburger place (Main, Hamburger, two other Burger type class) * Hamburger class should have name, bread roll type, meat, and up to 4 additional *...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT