Прошу прощения, что прошу еще раз,
, но какое-то время я пытался обойти эту ошибку:
#include <iostream>
using namespace std;
class time{
private:
int m;
int h;
public:
time():m(0),h(0) {};
time(int x,int y): m(x),h(y) {}
int getm() const {return this->m;}
int geth() const {return this->h;}
void print() const;
time operator+(time aa);
time operator-(const time &a) const;
};
void time::print() const
{
cout <<"Hour: "<<h<<endl<<"Mins: "<<m<<endl;
}
time time::operator+( time &a)
{
time temp;
temp.m= this->m+a.getm();
temp.h=this->h+a.geth();
return temp;
}
int main ()
{
return 0;
}
Я получаю сообщение о том, что время не указываеттипа, я не уверен в ошибке, она должна работать.
также относительно указателей
, учитывая, что у меня есть двойной указатель, указывающий на указатель, и этот указатель, указывающий на динамические данные.1010 *
int *ptr=new int
int **p=&ptr;
delete p;
поэтому удалит p, сначала удалит динамические данные, затем указатель ptr?