Hi All,
I wish to have a class call the constuctor from the class it inherits in within its own constuctor.
I have understand the constuct
public class myClass():Base(){}
But I wish to use a paramter for the class that is not determined untill the child constructor is executed.
Can anyone advise me of how this is done.
This is an example of what Im after but it doesnot seem to recognise the base class constuctors.
Code:
class Class1
{
int _c1id;
int _field1;
int _field2;
public Class1() { }
public Class1(int c1id)
{
_c1id = c1id;
//Get Data From DB
_field1 = 456;
_field2 = 789;
}
}
class Class2 : Class1
{
int _c2id;
public Class2(int c2id)
{
_c2id = c2id;
//Get C1 ID from DB
_c1id = 1;//FROM DB
base(_c1id);
}
}
======================================
"They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad."
--Shakespeare
======================================