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
Write a statement that declares a prototype for a function powerTo, which has two parameters. The first is a double and the seco
Dimas [21]

Answer:

Following are the statement of the program in the C++ Programming Language.

//prototype of the function

double powerTo (double, int);

Explanation:

In the following statement which is written in the C++ Programming Language.

  • The function prototype tells us what type of data type return by that function.
  • We declare the prototype of the function "powerTo()" which returns the double and pass two arguments first one is double data type and the second one is integer data type.
7 0
4 years ago
Which of the following statements opens the file info.txt for both input and output? a) dataFile.open("info.txt", ios::in &amp;&
azamat

Answer:

Correct answer is D

Explanation:

open is a function in c++ programming language used to interact with files.The function takes two parameters as input

  1. File name
  2. mode

File Name

File name is a string name of file to be opened.This is a compulsory parameter for open method.

Mode

Mode is an optional parameter in open function.Following are the accepted values of mode parameter

Prefix ios:: is added to start of each

  1. in (Open file in input mode for writing data to file)
  2. out (Open file in output / read-only mode to read data from file)
  3. binary (Open file in binary format)
  4. ate (Set the starting point of file to the end of file. Default starting point of file is start of file)
  5. "trunc" (If file is opened multiple times all previous data is replaced with new data)
  6. app (All operations of output are performed the end of file)

Use | operator to use multiple modes at a time.

3 0
3 years ago
Read 2 more answers
At the start of the school year, Brianna’s history teacher announces that students’ final grades will be weighted based on how t
Dennis_Churaev [7]

Answer:

it is A

Explanation:

did on edge test

5 0
3 years ago
Read 2 more answers
You have just received a generic-looking email that is addressed as coming from the administrator of your company. The email say
natta225 [31]

Answer:

Delete and block the email. It is obviously a scam.

Add-on:

I hope this helped you at all.

6 0
3 years ago
What is &lt;html&gt;
ipn [44]

the opening tag for an HTML document

8 0
3 years ago
Read 2 more answers
Other questions:
  • True or False: clicking ads and pop-ups like the one below could expose your computer to malware.
    11·2 answers
  • "what type of index has an index key value that points to a data row, which contains the key value? "
    9·1 answer
  • Writе thе dеclaration of a doublе pointеr namеd avеragе
    10·1 answer
  • (I made this up teehee) what anime is katski bakugo from
    15·2 answers
  • Provide examples of the cost of quality based on your own experiences
    14·1 answer
  • In the textbox below, write an email that you, as an administrative assistant at Techno Inc., would write to request information
    7·1 answer
  • All states that have altered judicial selection techniques in recent years have adopted some form of:
    10·2 answers
  • Gray London is a retired race car driver who helped Dale Earnhardt, Jr. get his start. He is writing a book and making a video a
    9·1 answer
  • A human subject’s photographs show two catchlights in each eye that are unwanted by the photographer. What is the most likely ca
    12·1 answer
  • PLEASE HELP ITS CODING AND I INCLUDED A SCREENSHOT OF WHAT TO DO
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!