Dynamic Object creation in MFC

Roshni Bhaskaran 1 Reputation point
2021-05-24T12:42:23.147+00:00

MFC internally uses CreateObject function to create class objects dynamically.

I was wondering as to what is the purpose of this feature.

We create objects dynamically using the new keyword in C++. What additional purpose does Dynamic Object creation of CObject class provide? Why was it there in the first place?

Developer technologies | C++
{count} votes

1 answer

Sort by: Most helpful
  1. Jeanine Zhang-MSFT 11,356 Reputation points Microsoft External Staff
    2021-05-25T01:54:08.297+00:00

    Hi

    MFC internally uses CreateObject function to create class objects dynamically.I was wondering as to what is the purpose of this feature.

    I suggest you could refer to the Doc: Run-Time Object Model Services

    Dynamic object creation enables you to create an object of a specified class at run time. For example, document, view, and frame objects must support dynamic creation because the framework needs to create them dynamically.

    Best Regards,

    Jeanine


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.