I want to create a class to hold my specific variable like a bitmap.
I must include this class and can use the bitmap without creating an instance of this class.
How can I do this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This is assuming you meant C++/CLI and not managed C++, as they are fairly different languages.
That will create a static class that can’t be instantiated, holding whatever static members you need.
If your class will only be holding static data, I would recommend doing it this way, via a static class. If you intend on letting the class be instantiated (it looks from your question that this isn’t the case), you shouldn’t declare it with
abstract sealedand simply make the member you want to access without an instance, static.