J
James Gockel
Im a newbie, but heres my input.
why don't you try
d.me
since d is the derived class?
-James
why don't you try
d.me
since d is the derived class?
-James
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
static void Main(string[] args)
{
DerivedClass d=new DerivedClass();
BaseClass b=d;
b.me() <<<<<<<<<<<<<<<<<<<<<This should run DerivedClass.Me() and return
the reference to a DerivedClass BUT IT DOESNT. It executes BaseClass.me
INSTEAD.
new public DerivedClass me()
David said:OK I'll be more specific. This is what I have now (PSEUDOCODE again):
public class BaseClass
{
public virtual Node me()
{
return this;
}
}
public class DerivedClass: BaseClass
{
new public DerivedClass me()
{
return this;
}
}
static void Main(string[] args)
{
DerivedClass d=new DerivedClass();
BaseClass b=d;
b.me() <<<<<<<<<<<<<<<<<<<<<This should run DerivedClass.Me() and return
the reference to a DerivedClass BUT IT DOESNT. It executes BaseClass.me
INSTEAD.
Please help if you've got any ideas.
Cheers
Dave
David said:OK I'll be more specific. This is what I have now (PSEUDOCODE again):
public class BaseClass
{
public virtual Node me()
{
return this;
}
}
public class DerivedClass: BaseClass
{
new public DerivedClass me()
{
return this;
}
}
static void Main(string[] args)
{
DerivedClass d=new DerivedClass();
BaseClass b=d;
b.me() <<<<<<<<<<<<<<<<<<<<<This should run DerivedClass.Me() and
return the reference to a DerivedClass BUT IT DOESNT. It executes
BaseClass.me INSTEAD.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.