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
Jack
NA
4
0
Newbie overriding problem
Dec 25 2008 3:25 AM
I can't work out how to override a function, I spent 3 hours reading and searching to no luck.
What I am trying to do is to have a function lets say called blah in a class lets say class1 that will return "One" to me. Then in another class, say class2 another function also called blah would return "Two".
Up to here it is ok
class TestClass
{
public class Class1
{
public virtual blah()
{
return "One";
}
}
class Class2: Class1
{
public override blah()
{
return "Two";
}
}
Then in my main I would like that depending on a variable or button status the first or second blah() is called but the command to call it must be the same, I cant one time use
Class1 s = new blah();
and the second time use
Class2 s = new blah(x);
That part I can't work out how to do. It is probably ultra simple or maybe I took the wrong way.
In any case, your help is much appreciated.
Reply
Answers (
1
)
Copy whole Listbox To another Listbox
get the content of a word document