Reputation: 349
Suppose I have outer class as A and a inner class B
template <class T, class K>
class A::public T::RadioSignal, public VarMethod<T> {
private:
B *bObject;
public:
class B : public std::vector<SamplePoint*>
{
public:
B(A<K, T> *outerInstance);
};
}
I am getting below error: Unknown type name 'B'
Upvotes: 0
Views: 221
Reputation: 16596
That error is at line B *bObject;
? But at that moment the class B
is not yet defined.
Either define the inner class ahead of it, or use forward reference. (class B;
is probably enough?)
edit: if you would use not only pointer, but also something more of B (like B bObject;
-> class B;
would be not sufficient, but as you are using only B *
, it should be enough just to forward declare existence of the class B. Then again, I would try to stay away from bare pointer usage, why don't you declare the full class B first and then declare directly B bObject;
as member instance of A? So you don't have to deal with new/delete.
Upvotes: 2