Is this an example of Polymorphism?

J

jm

I was reading about the provider model and found that providers have a
definition, the contract, that all provider implementations must have.

Is this an example of polymorphic behavior because there is a
definition (either an abstract class or an interface) and each
implementation has a different behavior for the same method (the same
method they must all have)?

So, I have a provider model/definition, or whatever is the correct
thing to call it. In that definition it says that anything that
inherits from the provider class (again, or whatever it is called) must
have a GetData (guessing) that has certain parameters (virtual).

In the implementation, I have an Oracle provider that has a override
GetData and in its Oracle model it does whatever to get data back from
the Oracle database. Sql Server, MySQL, and so on also have an
override GetData method that implements a particular version of the
inherited provider class.

Again, is this polymorphism?

Thank you.
 
G

Guest

From the quintessential Wikidpedia entry:
"polymorphism (object-oriented programming theory) is the ability of objects
belonging to different types to respond to method calls of methods of the
same name, each one according to an appropriate type-specific behaviour. The
programmer (and the program) does not have to know the exact type of the
object in advance, so this behavior can be implemented at run time "

In short, yes, you described polymorphic behavior.
Peter
 

Ask a Question

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.

Ask a Question

Top