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
nilkanth
NA
1
0
Polymorphism
Oct 1 2004 6:21 AM
I want to know whether this statement is true.. If you are not overriding a virtual method of base class in derived class, you can’t use base class method by using base keyword in derived class. Also when you will create an instance of derived class, it will call derived class method and you will only be able to access base class method when you will create instance of base class. public class Person { protected string ssn = "444-55-6666"; protected string name = "John L. Malgraine"; public virtual void GetInfo() { Console.WriteLine("Name: {0}", name); Console.WriteLine("SSN: {0}", ssn); } } class Employee: Person { public string id = "ABC567EFG"; public void GetInfo() { // Calling the base class GetInfo method: base.GetInfo(); Console.WriteLine("Employee ID: {0}", id); } } class TestClass { public static void Main() { Employee E = new Employee(); E.GetInfo(); } } But the above program works for me... Can anybody explain?!?!?
Reply
Answers (
1
)
Reading file online
Maintain state of checkboxes across datagrid paging