IMPLEMENT_DYNAMIC

Started by
3 comments, last by Emmanuel Deloget 17 years, 6 months ago
Hello, Anybody can describe what's IMPLEMENT_DYNAMIC in the MFC application.
Advertisement
IMPLEMENT_DYNAMIC?

It does what it says. If you use this macro in a header, the preprocessor will turn it into the necessary code to access the class at run-time.

Regards
Admiral
Ring3 Circus - Diary of a programmer, journal of a hacker.
What are the run-time classes?
Erm... Do you know what MFC is?

Everything provided by MFC (Microsoft Foundation Class) comes in the shape of a class derived from CObject, be it a network interface, a window, a command button or the manifestation of the application itself.

If you don't know what a class is, I suggest you get yourself a good book on C++. If you don't know what run-time means, I suggest you get yourself a good book on any programming language.

Sorry if I sound sarcastic, but your question is a little obscure.

Regards
Admiral
Ring3 Circus - Diary of a programmer, journal of a hacker.
Quote:Original post by TheAdmiral
Sorry if I sound sarcastic, but your question is a little obscure.


Less obscure than your answer [smile]

Runtime classes in the MFC terminology (as it doesn't really mean anything) are objects that enclose some informations that can be used to test the real underlying type of an object (providing that it inherits CObject) or to create new instances of this object given the class name as a string.

The RUNTIME_CLASS() macro is used to retrieve the hidden runtime class object from any CObject who implement that interface. It returns a CRuntimeClass instance, that can be used to feed some particular functions of the MFC (for example, CSplitterWnd::CreateView() need a CRuntimeClass object to be able to create the correct view object).

They are failry advanced stuff to use, and unless you really need them, I suggest you to just know that they exist, rely on the documentation and samples when you have to use them, and do not try to understand them right now. When you'll be more confident about your C++ skills you'll be able to understand them rather easily.

Regards,


This topic is closed to new replies.

Advertisement