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]
3 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]3 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
False when you tap or click the ‘decrease font size’ button, excel assigns the next lowest font size in the font size gallery to
castortr0y [4]
That is actually true. In order to format the font, margins and alignment of a form you need to s<span>elect the control that you want to format, then right-click the selection, and then click Format Control. What you do next is that on the Font tab you select the font type, font style, font size, other formatting options for the selected text and in order to finish to press ok </span>
6 0
3 years ago
Write a function shampoo_instructions() with parameter num_cycles. If num_cycles is less than 1, print "Too few.". If more than
Masteriza [31]

Answer:

See explaination

Explanation:

#Run the code in the python version 3.x.

#Define the function.

def shampoo_instructions(num_cycles):

#Check the cycles to be greater than 1.

if num_cycles < 1:

#Display the statement.

print('Too few.')

#Check the cycles to be greater than 4.

elif num_cycles > 4:

#Display the statement.

print('Too many.')

#The else part.

else:

#Initialize the variable.

N = 1;

#Begin the for loop.

for N in range(N, num_cycles+1):

#Print the result.

print(N , ": Lather and rinse.")

#Print the statement.

print('Done.')

#Call the function.

shampoo_instructions(2)

7 0
3 years ago
Space cushion includes
Ulleksa [173]

Answer:

D. sides

Explanation:

Space cushion includes sides of your vehicle.

8 0
2 years ago
Read 2 more answers
Which science topics would be suited for this organizational aid? Check all that apply.
IrinaVladis [17]

Answer:

Its A and E

Explanation:

3 0
3 years ago
Liam noticed someone had accessed his social media account and made several posts without his knowledge. Which of the following
jok3333 [9.3K]

Answer:

Liam could

1) Change the password

Be sure to change the password to a "strong" one (containing lots of characters, numbers, symbols) so that way the password would be difficult to guess.

2) Avoid logging onto social media on public computers or WiFi connections.

Using public WiFi leaves you vulnerable to someone accessing your information through Internet traffic. If you do use public computers, just make sure to log out.

3) Avoid giving out account information to friends and avoid opening suspicious links and emails.

Opening suspicious links or emails could allow malware to infect your computer the moment you open them. Friends can unknowingly share these links that are designed to steal information.

I hope this helped <3 please lmk if there's anything more to add.

4 0
3 years ago
Other questions:
  • A set of communication rules for the computer to follow is called, what?
    10·2 answers
  • Elvis has asked Bonnie out on a date to a baseball game. Elvis is a friend of Bonnie's classmate Ginger and she has met him a fe
    5·2 answers
  • Differentiate among web apps, mobile apps, and mobile web apps.
    14·2 answers
  • Write a Java program that prompts the user to enter a sequence of non-negative numbers (0 or more), storing them in an ArrayList
    5·1 answer
  • Write a function to output an array of ints on a single line. Funtion Should take an array and an array length and return a void
    9·1 answer
  • Released in 1976, the Apple I was Apple Computer's first product.<br><br> O True<br> O False
    6·1 answer
  • How to use emojis on chromebook without on-screen keyboard
    14·1 answer
  • 8. Which of the following is an output device
    14·1 answer
  • Compare and contrast hardware and software.
    11·2 answers
  • Why is a salt added to a password that is being stored in a database?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!