C++/CLI Properties

Tom 178 words

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.

Originally posted on my personal blog which was active from 2003 to 2020. You may have arrived here by redirection from the original permalink.

Elsewhere: Loading...

Sorry, new comments are disabled on older posts. This helps reduce spam. Active commenting almost always occurs within a day or two of new posts.