Hi,
I have two constructors of a class, each takes an object of two forms as arguments. But each has one object of another class as common.
X obj = new X();
obj is should be common to all constructors. Therefore i need to create another constructor that initializes the "obj" but i need each of the overlaoded constructors make calls to the constructor that initializes "obj".
public class Controller{
X obj;
//overlaoded constructor 1
public Controller(frmForm frm){
frm.tbxLastName.text = "XYZ";
//i need to make calls to the default constructor form here
}
public Controller(frmForm frm){
frm.tbx.Country = "sdfsfs";
//I need to make calls to the defualt cosntructor from here
}
public Controller(){
obj = new X();
}
}
How do i call the defualt constructor form each overloaded cosntructor?
cheers
akhilPosted Mar 27, 2009, 7:59 AM
if u want a basic functionality in all overloaded constructors like same in default and same as default and few other options in parametrized so u should make a private function containing such code then call it in default constructor and in parametrized along with code for form control which u are doing in sample code snippet.
akhilesh