Information générale
Catégorie:
Programmation Orientée Object
>I tried to format that on the screen, but it got garbled.
>
>Let's say you have a container and put controls in it and define it as a class. As you note, changes made later to the controls at the class level do not propagate to existing instances of the controls.
>
>In order to do that, create each object as a separate class. Make the composite object when instantiating. Then, when you change any property or method of a class, it will be propagated to all existing instances.
Are you saying I should drop a container on a form, and then the components in there, for each form?
Or do you mean I can continue to make this composite class before hand, but must make sure that I make and use a subclass of all the components that go into this container. That way any changes in the future should be done at the subclassed component, and then that WILL trickle down to all instances of the composite class wherever it is...??
If it's the latter, I can understand that a bit better, thanks. It's unfortunate to think though.. that if I want to make (for instance) a composite class that consists of 7 buttons lined up a certain way, that i'd have to make 7 different subclasses of the button object first, and then drop one instance each into the composite class, just incase I want to change a color property some day... Am I correct?
Thanks,
Dustin
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement