I have a class that is only used in one specific part of another class. It is not mentioned in any other parts of the main class. And I include the corresponding header at the top of a file.
Is there any way to "uninclude" the header after I've used it?
What I mean, is that after you "uninclude" the header with the class, references to the class would not be defined, and any calls to the class would throw an error when compiling.
Code:
// code section where "cubeData" should be visible #include "CubeData.h" void mainWidget::createGeoObjects() { cube = new cubeData(); // ... } // #uninclude "CubeData.h" - ??? // // code section where "cubeData" should be invisible void mainWidget::otherFunction() { cube = new cubeData(); // should result in a compile error // ... }
https://stackoverflow.com/questions/65431310/is-there-any-way-to-uninclude-a-file-in-c December 24, 2020 at 05:45AM
没有评论:
发表评论