If I have a C++/CLI form with textbox1 and a class called Dummy in another header file, what can I do if I want to change “directly” the value of textbox1.Text by a function exists in Dummy class?
If I have a C++/CLI form with textbox1 and a class called Dummy in
Share
C++ does single-pass compilation. That means you can’t use something until the compiler has already seen it.
When you have two classes using each other mutually, that can be tricky. Luckily C++ also allows forward declaration, which tells the compiler “Here is the signature for a class or function I’m going to provide you with later”.
In general, provide the compiler with the following, in this order:
forward declaration of classes
class definitions
class member function definitions
Often, the only thing needed is to put function definitions in a .cpp file, and make sure that .cpp file
#includes the header file for every class. For your problem, that’d mean you should put this line inDummy.cpp, which includes bothDummy.handmyform.h.