I have C# code, base class A
and derived class B
:
public class A
{
public virtual void print() {Console.WriteLine("a"); }
}
public class B:A
{
public override void print() { Console.WriteLine("b"); }
}
static void Main(string[] args)
{
A a= new B();
//In c++ I can use .Base:: to call base method from derived class instance
a.Base::print();
}
I can't modify these two classes and I don't know what can I do in C#, any suggestion?
Additionally, thanks to everyone joining into this discussion, and I would like to clarify why I need this behavior:
In .net framework, we have an interface IPostBackDataHandler to handle postback. and in there is a method
public bool LoadPostData( string postDataKey, NameValueCollection postCollection )
When I implement it and test, I find sometimes the given postback type of postCollection is NameValueCollection ,while other time it's HttpValueCollection (a derived class of NameValueCollection)
Then,if it is a type of HttpValueCollection, when I get item from it, eg. postCollection['ControlID'] and I input html in this control, HttpValueCollection.get_item() will always validate the input and view it as a defect. While NameValueCollection.get_item() won't
I don't want it operate validation automatically, at least I should decide whether it should be validated, should I?