I've being searching for the solution of this problem, and I think it has something due to nested namespaces.
Bellow we have the relevant part of it:
implementation.hpp That is an implementation of an Interface
#ifndef IMPLEMENTATION_H
#define IMPLEMENTATION_H
#include "class_b.hpp"
namespace XPTO {
class Implementation : public XPTO::Interface {
public:
Implementation();
~Implementation() override;
ReturnStatus
initialize() override;
private:
CLASS_B::Class_B b; // namespace CLASS_B, class Class_B
};
}
#endif
implementation.cpp
#include "implementation.hpp"
XPTO::Implementation::Implementation() {}
XPTO::ReturnStatus
XPTO::Implementation::initialize() {
b = new CLASS_B::Class_B::Class_B();
//namespace ClASS_B, class Class_B and constructor Class_B()
}
class_b.hpp
#ifndef CLASS_B_H
#define CLASS_B_H
namespace CLASS_B{
class Class_B {
public:
Class_B();
~Class_B();
void initialize();
};
}
#endif
The error is error: expected type-specifier b = new CLASS_B::Class_B::Class_B();
The compiler is pointing to the namespace CLASS_B.