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
Yadlapalli Srikanth
NA
272
82.7k
access supper class method with the instance hirarical base
Jan 8 2015 4:15 AM
Dear All,
I faced one interview question in polaris, They asked me to print the virtual method of the super class with the instance of B class. Is it possible by casting? if so please try and let me know.
class hirarical
{
public virtual void print()
{
Console.WriteLine("print virtual method");
}
public void printnorm()
{
Console.WriteLine("print virtual method");
}
}
class a : hirarical
{
public override void print()
{
Console.WriteLine("print a method");
//base.print();
}
}
class B : a
{
public override void print()
{
//need to access the virtual method of hierarical class with B instance can do casting with B instance
Console.WriteLine("print B method");
}
}
//need to access the
Reply
Answers (
3
)
Make a call from a Windows phone application using C#
Using TorchControl class to make a basic Flashlight app