Answer the question
In order to leave comments, you need to log in
Why is the class constructor not called?
There is such a real number class with two constructors:
class R
{
private:
double value;
public:
//конструктор
R(double a) : value(a) {};
R() : value(0) {};
//Геттер
double get_number() {return value;};
//Сеттер
void set_number(double a) {value = a;};
};
class Queue
{
private:
struct elem
{
elem *next, *prev;
R info;
};
elem *head, *tail;
int len;
public:
//конструктор
Queue(double inf)
{
head = new elem;
tail = new elem;
len = 1;
head->info.set_number(inf);
};
Queue()
{
head = NULL;
tail = NULL;
len = 0;
head->info.set_number(0);
}
...
a.dequeue();
Answer the question
In order to leave comments, you need to log in
You somehow misunderstand C++.
You have written:
Queue()
{
head = NULL;
tail = NULL;
len = 0;
head->info.set_number(0);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question