Thursday, April 10, 2008

C++/CLI Properties

Properties in C++/CLI are great and all, but, um, what if I want to put my class implementation in a different file from the class definition? You know, like, oh, every C++ program ever made in the entire history of the world. Microsoft even encourages the separation of definition from implementation by creating a .cpp and a .h file when you make the new managed class. I guess Microsoft figured we would just put the whole class implementation into the .h file while leaving the .cpp file empty. Yeah, that makes perfect sense... if you're on crack.

This rant came about because I was trying to implement a setter property (in the class.h file) that referenced some functions in another class. This resulted in all kinds of errors because at that point in the compilation, the setter did not understand anything about the implementation of the other class. You'd think that would be easy to fix by moving the property implementation into the class.cpp file where it belongs, but you'd be wrong because you can't do that. Blah.