Главная » 2019 » Октябрь » 8 » Классы 2
10:30
Классы 2

#include <iostream>
using namespace std;
class Auto
{
private:
    int year,month,day;
public:
    Auto()
    {
        year=2000; month=11; day=7;
    }
    Auto(int date_year, int date_month, int date_day)
    {
        year=date_year; month=date_month; day=date_day;
    }
    void set(int date_year, int date_month, int date_day)
    {
        year=date_year; month=date_month; day=date_day;
    }
    void vivod()
    {
        cout<<"Year="<<year<<" Month="<<month<<" Day="<<day<<endl;
    }
    ~Auto()
    {
        cout<<"Class is not working!"<<endl;
    }
};
int main()
{
    Auto bmw;
    Auto volvo(2019,05,10);
    bmw.vivod();
    volvo.vivod();
    system("PAUSE");
}

 

Просмотров: 168 | Добавил: denjes | Рейтинг: 0.0/0
Всего комментариев: 0
avatar