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
amit shukla
NA
78
66.9k
give the region
Aug 4 2015 2:46 PM
using
System
;
namespace
Polymorphism
{
class
A
{
public
void
Test
()
{
Console
.
WriteLine
(
"A::Test()"
);
}
}
class
B
:
A
{
public
new
virtual
void
Test
()
{
Console
.
WriteLine
(
"B::Test()"
);
}
}
class
C
:
B
{
public
override
void
Test
()
{
Console
.
WriteLine
(
"C::Test()"
);
}
}
class
Program
{
static
void
Main
(
string
[]
args
)
{
A a
=
new
A
();
B b
=
new
B
();
C c
=
new
C
();
a
.
Test
();
// output --> "A::Test()"
b
.
Test
();
// output --> "B::Test()"
c
.
Test
();
// output --> "C::Test()"
a
=
new
B
();
a
.
Test
();
// output --> "A::Test()"
b
=
new
C
();
b
.
Test
();
// output --> "C::Test()"
Console
.
ReadKey
();
}
}
}
please give the logical answer.
why a.test() call A class function and why b.test() call C class test() function .
please share only technical region.
Reply
Answers (
6
)
c# vs powershell
Select Files from Open Dialog and SaveAs to Application