Karthik Agarwal

Karthik Agarwal

  • NA
  • 748
  • 266.5k

How to use forward declaration of class from different namespaces?

Feb 15 2012 4:23 AM
Hi,

I have something similar to the following post, if not may be an extension  http://www.c-sharpcorner.com/Forums/Thread/154204/how-to-pass-a-string-from-one-form-to-another.aspx

I have a namespace1 where i am instantiating the class in namespace2.
I have also included the header file and namespace2 i.e the class i have instantiated in namespace1 in 3 different places in namespace1 but what i need now i want to access properties of 2 different classes which are there in 3 header files where i have already included the namespace2 and the header file in as well.
This is just like including one header file1 in header file2 and vice versa  which is not allowed which makes it a loop. Hence i tried forward declaration of the class in namespace1 which has access to the other two classes and properties and thought of using the same in namespace2 where i have not succeeded or need more support to work on.

Answers (10)