I am trying to understand a hard to grasp concept. If any of you will give me pointers, it will be much appreciated.
Say there is a class Document with two members
void Read();
void Write();
Now there is another class called Note, and it inherits Document class
override Read();
new void Write(); //Emphasis on 'new'
Now say I create a new Document reference, and have it refer to a new Note object (which inherits Document)
Document doc=new Note();
Then I try doc.Write, and here is where I am confused. When I implement doc.Write, why would it not use the 'new' Write()? It uses Document.Write, not Note.Write when I specifically specified new on the Write in Note.
Say there is a class Document with two members
void Read();
void Write();
Now there is another class called Note, and it inherits Document class
override Read();
new void Write(); //Emphasis on 'new'
Now say I create a new Document reference, and have it refer to a new Note object (which inherits Document)
Document doc=new Note();
Then I try doc.Write, and here is where I am confused. When I implement doc.Write, why would it not use the 'new' Write()? It uses Document.Write, not Note.Write when I specifically specified new on the Write in Note.