Andy Sujoto

Andy Sujoto

  • NA
  • 8
  • 19.7k

Custom Object with parameter in declaration

Sep 21 2010 6:13 AM
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)