Thanks Daniel.
You solved my problem succesfully.
I would like to you ask about situation that I want to have memeber in
struct S, that point to function in class C (not whole class) does it changes
situation? (All other are the same)
struct S
{
//POINTER TO CLASS C MEMBER FUNCTION: IncrementSelectedCount()
};
class C
{
S** items;
private: int selectedCount;
private: void incrementSelectedCount(void)
{
selectedCount++;
}
};
"Carl Daniel [VC++ MVP]" wrote:
MilanB wrote:
Hello
I have struct, and class that handle array of previous mentioned
structs. How to declare struct member, that will point to class that
it belongs?
struct S
{
//HOW TO ADD MEMBER THAT WILL POINT TO CLASS C ???
}
class C
{
S** items;
}
You need to use a "forward declaration":
class C;
struct S
{
C* m_c; // you can use C* or C&, but not just C
};
class C
{
S** items;
};
-cd