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
Andrew
NA
3
0
use subclass field in inherited method
Aug 1 2009 6:36 PM
Hi,
I can't figure out how to get a method of an abstract class to refer to the values of a field stored in the subclasses.
Example in pseudo-code:
class Parent{
field _Description = "I'm the parent";
void PrintDescription(){
Console.WriteLine(this._Description);
)
}
class Child: Parent{
field _Description = "I'm the child";
}
If I instantiate the child class and call its PrintDescription() method, it prints
"I'm the parent"
How can I tell the 'PrintDescription()' method in the base class to always use the subclass's value for the field '_Description'?
Thanks.
Reply
Answers (
3
)
index of same digits in any number
creating wcf..