В настоящее время я пытаюсь получить следующий код для компиляции:
Terminallog.hh
#ifndef TERMINALLOG_HH
#define TERMINALLOG_HH
#include <string>
#include <sstream>
#include <iostream>
class Terminallog {
public:
Terminallog();
virtual ~Terminallog();
class Warn {
public:
Warn();
private:
bool lineended;
};
friend class Terminallog::Warn;
protected:
private:
Warn warn;
};
Terminallog.cc
// stripped code
Terminallog::Terminallog() {
Warn this->warn();
}
Terminallog::Warn::Warn() {
this->lineended = true;
}
//stripped code
Ну, как вы, вероятно,угадал alredy, его провал ;-).Мой компилятор говорит:
g++ src/terminallog.cc inc/terminallog.hh -o test -Wall -Werror
In file included from src/terminallog.cc:8:
src/../inc/terminallog.hh:56: error: declaration of ‘Terminallog::Warn Terminallog::warn’
src/../inc/terminallog.hh:24: error: conflicts with previous declaration ‘void Terminallog::warn(std::string)’
, что оставляет меня без выбора.Я явно делаю что-то не так, однако понятия не имею, как это решить.Буду признателен за любые подсказки.
Заранее спасибо
ftiaronsem