'How can I extern classes in a namespace?
I want to extern classes in a namespace, without defining the entire class again. For example, I have class A:
class A
{
private:
int value;
public:
A(int value);
int get_value();
};
and class B:
class B
{
private:
int value;
public:
B(int value);
int get_value();
};
But I want to extern the A and B classes, without defining all of them in the namespace again, like:
#include "a.hpp"
#include "b.hpp"
namespace kc
{
extern class A;
extern class B;
}
and I don't want to do:
namespace kc
{
class A
{
private:
int value;
public:
A(int value);
int get_value();
};
class B
{
private:
int value;
public:
B(int value);
int get_value();
};
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
