TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
murali 0
NA
3
0
Pl. help me to understand this code (hiding)?
May 12 2004 12:57 PM
I saw this code in one of the notes. class A { public virtual void MyName() {Console.Writeline("My Name is A");} } class B:A { public override void MyName() {Console.Writeline("My Name is B");} } class C:B { public new virtual void MyName() {Console.Writeline("My Name is C");} } class D:C { public override void MyName() {Console.Writeline("My Name is D");} } C c = new D(); c.MyName(); //---------->prints "My name is D" A a = new D(); a.MyName(); //---------->prints "My name is B" ?????????? I thought a.MyName() should print "My name is D". Can any one explain why?. Any notes on hiding/Dynamic binding on the web/books? Thanks
Reply
Answers (
2
)
TextBox in c#
moving forms