2
Answers

Custom Object with parameter in declaration

Andy Sujoto

Andy Sujoto

14y
1.7k
1
Hi all,

How do i create a custom object that derived from existing object + a parameter that can i pass to this custom object? Where should i put the coding the add the object ?

For example :
i create a custom panel, but i want to be a able to pass parameter (in declaration) to add 1 object to the panel.
in the command might look like this :
MyPanel mp = new MyPanel(ObjectA);
and i don't want like this :
MyPanel mp = new MyPanel();
mp.AddingNewObject(ObjectA);


The real example as we can seen on OleDbCommand :
we can just issue :
OleDbCommand odc = new OleDbCommand("SELECT * FROM Table1");
rather than:
OleDbCommand odc = new OleDbCommand();
odc.CommandText = "SELECT * FROM Table1";


Thanks,
Andy
Answers (2)