Hi,
I was asked a question in a recent interview, where in ASP.Net is
polymorphism used?
I got differrent answers from different people,
One said ToString() method because it is working for different classes.
One said OnInit() method of System.Web.UI.Page class because it's defined
virtual and that's the key to polymorphism.
The most concise definition I can find for polymorphism:
Same method reacts differently for different class.
Any comments?
Thanks in Advance 10 5182
I'm not THE expert on this but I think it's when the same method is used
multiple times within the same class and has a different interface. The
most obvious example is the overloaded constructors in the classes and in
general any method that is overloaded.
--Buddy
"Danny Ni" <dn**@yahoo.com> wrote in message
news:uY**************@TK2MSFTNGP12.phx.gbl... Hi,
I was asked a question in a recent interview, where in ASP.Net is polymorphism used?
I got differrent answers from different people, One said ToString() method because it is working for different classes. One said OnInit() method of System.Web.UI.Page class because it's defined virtual and that's the key to polymorphism.
The most concise definition I can find for polymorphism: Same method reacts differently for different class.
Any comments?
Thanks in Advance
Buddy Ackerman <bu**************@buddyackerman.com> wrote: I'm not THE expert on this but I think it's when the same method is used multiple times within the same class and has a different interface. The most obvious example is the overloaded constructors in the classes and in general any method that is overloaded.
No, overloading isn't polymorphism - overriding is polymorphism.
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Hi Jon,
Just an addition for the OP.
And can be used in ASP.NET.
Cor No, overloading isn't polymorphism - overriding is polymorphism.
Jon,
I understand that Overloading IS "ad hoc" polymorphism!
While Overriding is "universal - parametric" polymorphism. http://www.javaworld.com/javaworld/j...polymorph.html
Hope this helps
Jay
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om... Buddy Ackerman <bu**************@buddyackerman.com> wrote: I'm not THE expert on this but I think it's when the same method is used multiple times within the same class and has a different interface. The most obvious example is the overloaded constructors in the classes and
in general any method that is overloaded.
No, overloading isn't polymorphism - overriding is polymorphism.
-- Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet If replying to the group, please do not mail me too
Doh! While Overriding is "universal - parametric" polymorphism.
Overriding is "universal - inclusion" (or subtype) polymorphism.
We need to wait for Generics before we will have parametric polymorphism.
Jay
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:O9*************@tk2msftngp13.phx.gbl... Jon, I understand that Overloading IS "ad hoc" polymorphism!
While Overriding is "universal - parametric" polymorphism.
http://www.javaworld.com/javaworld/j...polymorph.html
Hope this helps Jay
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message news:MP************************@msnews.microsoft.c om... Buddy Ackerman <bu**************@buddyackerman.com> wrote: I'm not THE expert on this but I think it's when the same method is
used multiple times within the same class and has a different interface.
The most obvious example is the overloaded constructors in the classes and in general any method that is overloaded.
No, overloading isn't polymorphism - overriding is polymorphism.
-- Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet If replying to the group, please do not mail me too
Thank you all very much for making me more confused.
Does that mean OnInit() method exhibit polymorphism?
Thanks Again
"Danny Ni" <dn**@yahoo.com> wrote in message
news:uY**************@TK2MSFTNGP12.phx.gbl... Hi,
I was asked a question in a recent interview, where in ASP.Net is polymorphism used?
I got differrent answers from different people, One said ToString() method because it is working for different classes. One said OnInit() method of System.Web.UI.Page class because it's defined virtual and that's the key to polymorphism.
The most concise definition I can find for polymorphism: Same method reacts differently for different class.
Any comments?
Thanks in Advance
Danny,
Yes, as it virtual, virtual means you can overload.
Jay
"Danny Ni" <dn**@yahoo.com> wrote in message
news:uU**************@TK2MSFTNGP10.phx.gbl... Thank you all very much for making me more confused. Does that mean OnInit() method exhibit polymorphism?
Thanks Again
"Danny Ni" <dn**@yahoo.com> wrote in message news:uY**************@TK2MSFTNGP12.phx.gbl... Hi,
I was asked a question in a recent interview, where in ASP.Net is polymorphism used?
I got differrent answers from different people, One said ToString() method because it is working for different classes. One said OnInit() method of System.Web.UI.Page class because it's
defined virtual and that's the key to polymorphism.
The most concise definition I can find for polymorphism: Same method reacts differently for different class.
Any comments?
Thanks in Advance
Jay B. Harlow [MVP - Outlook] <Ja************@msn.com> wrote: Yes, as it virtual, virtual means you can overload.
No, virtual means you can *override*.
(I know this was just a slip of the fingers - I'm only correcting it
for the OP's benefit :)
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jay B. Harlow [MVP - Outlook] <Ja************@msn.com> wrote: I understand that Overloading IS "ad hoc" polymorphism!
While Overriding is "universal - parametric" polymorphism.
http://www.javaworld.com/javaworld/j...polymorph.html
Interesting - I haven't seen that definition before. (Foldoc gives a
shorter but similar definition though.)
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jon,
Doh! yep I meant override...
Thanks for catching it...
Jay
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om... Jay B. Harlow [MVP - Outlook] <Ja************@msn.com> wrote: Yes, as it virtual, virtual means you can overload.
No, virtual means you can *override*.
(I know this was just a slip of the fingers - I'm only correcting it for the OP's benefit :)
-- Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet If replying to the group, please do not mail me too This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Mike Meng |
last post by:
hi all,
I'm a newbie Python programmer with a C++ brain inside. I have a
lightweight framework in which I design a base class and expect user to
extend. In other part of the framework, I heavily...
|
by: Ken |
last post by:
Hi.
Can anyone refer me to any articles about the compatibility between
c++ polymorphism and real-time programming?
I'm currently on a real-time c++ project, and we're having a
discussion...
|
by: E. Robert Tisdale |
last post by:
polymorph just means "many form(s)".
The definition in plain English
http://www.bartleby.com/61/66/P0426600.html
and narrower definitions in the context of computer programming
...
|
by: richard pickworth |
last post by:
Can anyone explain polymorphism?(very simply).
thanks
richard
|
by: LP |
last post by:
Hi, I understand the concept/definition of polymorphism. But what does the
term "runtime polymorphism" mean? I was asked to define it during a
technical interview. I gave a guy vanilla definition...
|
by: Krivenok Dmitry |
last post by:
Hello all!
Perhaps the most important feature of dynamic polymorphism is
ability to handle heterogeneous collections of objects.
("C++ Templates: The Complete Guide" by David Vandevoorde
and...
|
by: Seigfried |
last post by:
I have to write a paper about object oriented programming and I'm doing
some reading to make sure I understand it. In a book I'm reading,
however, polymorphism is defined as:
"the ability of two...
|
by: sarathy |
last post by:
Hi all,
I need a small clarification reg. Templates and
Polymorphism. I believe templates is really a good feature, which can
be used to implement generic functions and classes. But i doubt...
|
by: chsalvia |
last post by:
I've been programming in C++ for a little over 2 years, and I still
find myself wondering when I should use polymorphism.
Some people claim that polymorphism is such an integral part of C++,...
|
by: Bart Friederichs |
last post by:
Hello,
I created the following inheritance:
class Parent {
public:
void foo(int i);
};
class Child : public Parent {
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |