jeudi 29 janvier 2015

configuring app dynamically using prototype pattern

I am reading about prototype pattern by GoF book. Here is the text snippet



Configuring an application with classes dynamically: Some runtime environments let you load classes into an application dynamically. The prototype pattern is the key to exploiting such facilities in a language like C++.


An application that wants to create instances of a dynamically loaded classes won't be able to reference its constructor statically. Instead, runtime environment creates an instance of each class automatically when it's loaded, and registers with a prototype manager. Then the application can ask the prototype manager for newly loaded classes, classes that weren't ;omled with the program orginally



My questions on above




  1. What does author mean by "An application that wants to create instances of a dynamically loaded classes won't be able to reference its constructor statically" ? For example if we use dynamic link library I can still create object using new so what does author mean by we won't be able to reference constructor statically?




  2. Request to give an example how prototype pattern is used to exploit load classes application dynamically.




Aucun commentaire:

Enregistrer un commentaire