Добавил:
Рад, если кому-то помог Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
0
Добавлен:
01.11.2025
Размер:
437 б
Скачать
#include <iostream>
#include <locale>
using namespace std;

class Animal {
public:
    virtual void print() const = 0;
    virtual ~Animal() {}
};

class Elephant : public Animal {
public:
    void print() const override { 
        cout << "Elephant" << endl; 
    }
};

int main() {
    setlocale(LC_ALL, "ru_RU.UTF-8");
    
    Elephant s; 
    const Animal* a = &s;
    
    a->print();
    
    return 0;
}
Соседние файлы в папке Лаба6