Classes using each other

Started by
1 comment, last by VizOne 15 years, 8 months ago
Hey. Can I do something like this:

class TypeA{
    TypeB toTypeB{
        //code
    }
}

class TypeB{
    TypeA toTypeA{
        //code
    }
}
Advertisement
If you're talking Java then yes you can. This is in fact a very common practice with respect to listeners and such.
Same for C#. In C++ you can use forward declarations:
Andre Loker | Personal blog on .NET

This topic is closed to new replies.

Advertisement