0

Hi,
let's say I define this two classes that do not inherit from one another.
I get an error at line 10: field "DataNoFather" has incomplete type.
1.Any idea what that means and how to fix it?
2. Is it possible to have a variable like DataNoSon labeled with type NoFather? (like I have in line 21)

thanks

class NoFather
{
	public:
		NoFather();
		~NoFather();
		NoFather GetDataNF() const;
		NoFather SetDataNF();

	private:
		NoFather DataNoFather;
};

class NoSon
{
	public:
		NoSon();
		~NoSon();

	private:

		NoFather DataNoSon;
};
2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by freelancelote
1

You are trying to build absolutely senseless, absurd class NoFather (remember The House That Jack Built... ;) ?):

class NoFather {
...
private: NoFather DataNoFather;
};

Well, we have an object of type NoFather which has a member of type NoFather which has a member of type NoFather...

Formally at the point of DataNoFather declaration all the class NoFather was not completely constructed (that's why you get the message). In actual fact you are trying to construct an impossible thing...

Votes + Comments
Thanks.
0

ArkM,
thank you. Now that you mention it, it is actually quite silly.
Ah!, no need to answer the second question. I found it is possible.
Thank you again

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.