---
# System prepended metadata

title: Animal method override exp 1

---

# Animal method override exp 1

```cpp=
#include <stdio.h>

class Animal {
    public:
    void bark() {
        printf("???\n");
    }
};

class Cat : public Animal {
    public:
    void bark() {
        printf("Meow\n");
    }
};

class Dog : public Animal {
    public:
    void bark() {
        printf("Wan!\n");
    }
};

int main() {
    Animal a;
    Cat c;
    Dog d;
    
    a.bark();
    c.bark();
    d.bark();
    return 0;
}


```