Загрузка...

Ошибка с++

Тема в разделе C/C++ создана пользователем ecco 26 янв 2022. 377 просмотров

  1. ecco
    ecco Автор темы 26 янв 2022 Заблокирован(а) 525 24 ноя 2020
    #include <iostream>

    class temp{
    protected:
    double value;

    public:
    virtual double cels() = 0;
    virtual double far() = 0;
    virtual double kalv() = 0;

    virtual void operator=(temp& t) = 0;
    temp(double val);
    };

    temp::temp(double val) : value(val) {}

    class Cels : public temp{
    public:
    double cels();
    double far();
    double kalv();

    void operator=(temp& t);
    Cels(double value);
    };

    Cels::Cels(double val) : temp(val) {}
    void Cels::operator=(temp& t){ value = t.cels(); }
    double Cels::cels(){ return value; }
    double Cels::far(){ return value * 9.0 / 5.0 + 32.0; }
    double Cels::kalv(){ return value + 273.15; }

    class Far : public temp{
    public:
    double cels();
    double far();
    double kalv();

    void operator=(temp& t);
    Far(double value);
    };

    Far::Far(double val) : temp(val) {}
    void Far::operator=(temp& t){ value = t.far(); }
    double Far::cels(){ return (value - 32.0) / 5.0 * 9.0; }
    double Far::far(){ return value; }
    double Far::kalv(){ return (value - 32.0) * 5.0 / 9.0 + 273.15; }

    class Kalv : public temp{
    public:
    double cels();
    double far();
    double kalv();

    void operator=(temp& t);
    Kalv(double value);
    };

    Kalv::Kalv(double val) : temp(val) {}
    void Kalv::operator=(temp& t){ value = t.kalv(); }
    double Kalv::cels(){ return value - 273.15; }
    double Kalv::far(){ return (value - 273.15) / 5.0 * 9.0 + 32.0; }
    double Kalv::kalv(){ return value; }


    (.text+0x24): undefined reference to `main'
    collect2: error: ld returned 1 exit status

    что это?
     
  2. MisterMixa
    MisterMixa 26 янв 2022 Заблокирован(а) 9 4 окт 2021
    Ты чем компилируешь?
     
    1. MisterMixa
      MisterMixa, Или вроде тебе метод main требуется
    2. Посмотреть следующие комментарии (1)
Top
Загрузка...