S
Shikari Shambu
Hi,
I have a class that is derived from another class.
Say, Class Child dervies from Class Parent
Class Parent has a constructor that takes two params
public Parent(string A, string B)
I want Class Child to have a constructor that takes just one param but calls
the parents two param constructor
Something like
public Child (string A)
{
B = "Hello";
// Call the two param constructor here
}
I had to do a new to acheive this
public Child(string A)
{
B = "Hello";
// Call the two param constructor here
new Child(A, B)
}
Is there any other ways of doing what I did? And, what is the impact of the
new within the constructor?
TIA
I have a class that is derived from another class.
Say, Class Child dervies from Class Parent
Class Parent has a constructor that takes two params
public Parent(string A, string B)
I want Class Child to have a constructor that takes just one param but calls
the parents two param constructor
Something like
public Child (string A)
{
B = "Hello";
// Call the two param constructor here
}
I had to do a new to acheive this
public Child(string A)
{
B = "Hello";
// Call the two param constructor here
new Child(A, B)
}
Is there any other ways of doing what I did? And, what is the impact of the
new within the constructor?
TIA