Answer the question
In order to leave comments, you need to log in
How to define such a destructor in C++?
I received a test task in the spirit of "Implement a class with such an interface":
class LogReader
{
public:
LogReader(...);
~LogReader(...);
bool Open(...); // открытие файла, false - ошибка
void Close(); // закрытие файла
bool SetFilter(const char *filter); // установка фильтра строк, false - ошибка
bool GetNextLine(char *buf, // запрос очередной найденной строки,
const int bufsize); // buf - буфер, bufsize - максимальная длина
// false - конец файла или ошибка
};
Answer the question
In order to leave comments, you need to log in
Such an interface in C++ does not make sense purely syntactically. All these ... must be replaced with something. You cannot pass arguments to the destructor. So just throw them away and don't worry.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question