1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
malfutka [58]
2 years ago
14

"The ability to create methods with the same name that are in different classes" is known as ________.

Computers and Technology
1 answer:
Jlenok [28]2 years ago
6 0

Answer:

Polymorphism

Explanation:

Polymorphism is the ability of an object to take multiple forms. It is an important concept of Object Oriented Programming. Polymorphism is used in Object Oriented Programming when a reference of a parent class is used to refer to a child class object. It allows to perform a single action in different ways. For example a person can possess different characteristics at the same time. A person can be a father, husband, employee or student. The same person can have different behaviors in different circumstances.

Example:

Suppose there is class Animal with a procedure sound(). This method can have different implementation for different animals. For this purpose lets take two derived classes Cow and Cat that extend the Animal class (parent/base class). Now the method sound() can be used in different ways for Cow and Cat.

public class Animal{

public void sound(){

System.out.println("Animal is making a sound");  } }

public class Cat extends Animal{

 public void sound(){

  System.out.println("Meow");     } }

The output is Meow. The same method sound() is used for cat subclass.

public class Cow extends Animal {

  public void sound(){

    cout<<"Mooo";  }}

The output is Mooo. The method sound() is used for a Cow subclass which returns the sound of Cow in output.

So the same function i.e. sound() behaves differently in different situations which shows Polymorphism.

Polymorphism has 2 types.

One is compile time polymorphism which is called overloading. In method overloading a class can have more than one functions with same name but different parameters. Methods can be overloaded by change in number or type arguments. For example overloading a function method() can take the following forms in which the name remains the same and parameters are different.

void method(int a)

void method(float a)

void method(float a, float b)

Second type is run time polymorphism which is called overriding. Method overriding is when a method declared in derived class is already present in base class. In this way derived/child class can give its own implementation to base/parent class method. Method present in base class is called overridden and that in subclass is called overriding method. The example of Animal Cow and Cat given above is an example of overriding.

You might be interested in
Write pseudocode for washing a car using at least five steps.
Travka [436]

Answer:

#include <iostream>

int main()

{

bool carWashed{ 0 };

bool washCar{ 0 };

while(carWashed == 0)

{

 washCar();

}

if(washCar == 1)

{

carWashed{ 1 }

}

}

Explanation:

c++

5 0
2 years ago
A ____________ is a set of commands which can be run by calling it by name.
mixas84 [53]
The answer to this question is a protocol.
7 0
3 years ago
Read 2 more answers
When Windows deletes the driver package and driver files, in what situation might it not delete driver files used by the device
musickatia [10]

Answer:

when there is no junk

Explanation:

3 0
3 years ago
How could the following line of code be shortened?
Alinara [238K]

Answer:

2

Explanation:

The second option is the only one that will work. The last would work but doesn't make the code any shorter.

8 0
1 year ago
A personal computer system is composed of the processing unit, graphics board, and keyboard with reliabilities of 0.976, 0.785,
frosja888 [35]

Answer:

The answer to the following question is the option "B".

Explanation:

In computer science, the term Reliability is an attribute for any computer-related element like software or hardware. It consistently acts according to its terms. It has a lengthy process for considering one of three similar properties that must be analyzed when using a computer component. So the answer to this question is option B which is "0.684".

7 0
3 years ago
Other questions:
  • Which letters appear in the home row on a keyboard?
    14·2 answers
  • If you press the tab key when you're in in the last cell of a table,
    10·1 answer
  • Discuss the differences between permanent internal memory and volatile internal memory.
    14·1 answer
  • ) How many switching functions of two variables (x and y) are there?
    11·1 answer
  • Software that protects confidentiality by screening outgoing documents to identify and block transmission of sensitive informati
    12·1 answer
  • There are how many GPS satellites orbiting the earth
    15·1 answer
  • Organizing speech ideas according to physical space, direction, or location calls for a _____ organizational pattern.
    11·1 answer
  • The physical part or components of a computer system called​
    5·2 answers
  • How to enter date in a Date/Time field?​
    8·1 answer
  • The quickest way to change a word is to double
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!