tags:

views:

69

answers:

2

Is it possible to inherit a method within a class?
Or does it always need to be parent class inheriting child class?

For example:

A class called make_chart

Has:

public void style_Chart(Chart chartName,....)
{

}

Can I then inherit style_Chart into a new method called style_Chart2?

Something like this:

public void style_Chart2: style_Chart(new parameter)
{

}
+3  A: 

Within the same type, you would just invoke it:

public void style_Chart2()
{
    style_Chart({some parameters});
}

If you are dealing with sublasses, you might also consider virtual / base / override. There is a chaining syntax, but it only applies to constructors ( : base(...) or : this(...)).

Marc Gravell
Thanks Marc - The simplest solutions are always the best.
John M
+2  A: 

I think you just want method overloading

public void style_Chart(Chart chartName) {

}

public void style_Chart(Chart chartName, new parameter) { 
    style_Chart(chartName);
    //now do things with new parameter
}
Bob