-
inheritance [RESOLVED]
When you right-click a control and then select "copy", then paste that copy elsewhere, is that the same as creating a new instance and slapping in the clause "inherits yadda yadaa" in the new control somewhere?
If not, what are the differences? Obviousely, copying a control has advantages...sizes and colors will be consistant and quickly applied for example.
but, is this the same as "inheritance" ?:confused:
-
When you copy a control , you actuall copy the control design with all it's properties (name , font ,color ...etc ) with no code . But when you inherit a control you'll gain access to its all code including methods .
-
ok. so is that to say you can't have use the members with the copied control? If not, I'm in t r o u b l e :) I have tried to save time by copying my controls that I needed to have the same look and size etc, etc. :(
lol
-
If you don't want to go inheritance route , then just copy your controls . After that you need to copy the code to the copied controls . Since they have the same names , this shouldn't be a problem . They will run as if the original .
-
Inheritance is when used when you want to make a new kind of control based on an existing control. So if you wanted to add some new functionality to a combobox then you would inherit from it add the functionality and have a new type of combobox. If you just want several controls on a form or in a project that are the same then I would not use inheritance but copy them as you have done.