Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

polymorphism c++

Leo Fras answered on May 23, 2022 Popularity 9/10 Helpfulness 1/10

Contents


More Related Answers

  • what is polymorphism
  • Java Polymorphism
  • what is polymorphism
  • polymorphism in php
  • Polymorphism
  • What is Polymorphism?
  • polymorphism
  • install typora
  • polymorphism java
  • polymorphism javascript
  • Runtime polymorphism in java
  • What is Polymorphism
  • What do you mean by Polymorphism ? Explain it with an example ?
  • polymorphism js
  • php polymorphism
  • does polymorphism allow reuse of code?
  • where do you use polymorphism in framework
  • polymorphism c++ virtual
  • Arduino C++ polymorphism
  • Implementing Polymorphism Using Inheritance
  • polymorphism in C#

  • polymorphism c++

    -1

    #include

    class Animal {

    public:

    void action() {

    std::cout << "The animal does something.\n";

    }

    };

    class Fish: public Animal {

    public:

    void action() {

    std::cout << "Fish swim.\n";

    }

    };

    class Bird: public Animal {

    public:

    void action() {

    std::cout << "Birds fly.\n";

    }

    };

    int main() {

    Animal newAnimal;

    Fish newFish;

    Bird newBird;

    newAnimal.action();

    newFish.action();

    newBird.action();

    return 0;

    }

    Popularity 9/10 Helpfulness 1/10 Language cpp
    Source: Grepper
    Link to this answer
    Share Copy Link
    Contributed on Aug 14 2023
    Leo Fras
    0 Answers  Avg Quality 2/10

    Closely Related Answers



    2
    Popularity 10/10 Helpfulness 2/10 Language cpp
    Source: Grepper
    Tags: c++
    Link to this answer
    Share Copy Link
    Contributed on May 23 2022
    Msk SK
    0 Answers  Avg Quality 2/10

    0
    Popularity 10/10 Helpfulness 2/10 Language cpp
    Tags: c++
    Link to this answer
    Share Copy Link
    Contributed on Aug 12 2022
    Arduino nerd
    0 Answers  Avg Quality 2/10

    1
    Popularity 10/10 Helpfulness 2/10 Language cpp
    Tags: c++
    Link to this answer
    Share Copy Link
    Contributed on Aug 16 2022
    Successful Shrike
    0 Answers  Avg Quality 2/10

    0
    Popularity 10/10 Helpfulness 2/10 Language cpp
    Source: Grepper
    Tags: c++
    Link to this answer
    Share Copy Link
    Contributed on May 23 2022
    naly moslih
    0 Answers  Avg Quality 2/10

    0
    Popularity 10/10 Helpfulness 2/10 Language cpp
    Tags: c++
    Link to this answer
    Share Copy Link
    Contributed on Aug 04 2022
    Envsion
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.