This repository has been archived on 2023-05-13. You can view files and clone it, but cannot push or open issues or pull requests.
mipt_cpp/seminar01_overload/classroom_tasks/code/02function_overload/animals.cpp

30 lines
311 B
C++
Raw Normal View History

2022-09-01 16:37:41 +03:00
#include <iostream>
using std::cout, std::endl;
struct Cat {};
struct Dog {};
struct Cow {};
void say(Cat a)
{
cout << "Meow" << endl;
}
void say(Dog a)
{
cout << "Woof" << endl;
}
void say(Cow a)
{
cout << "Mooo" << endl;
}
int main()
{
Cow x;
say(x);
}