473,387 Members | 1,641 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Is this an example of Polymorphism?

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.

Oct 31 '06 #1
1 1319
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

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"jm" wrote:
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.

Oct 31 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
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...
35
by: JKop | last post by:
http://msdn.microsoft.com/library/default.asp?url=/library/en- us/vccore98/HTML/_core_using_strict_type_checking.asp Pay particular attention to: The types WPARAM, LPARAM, LRESULT, and void *...
3
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 ...
11
by: richard pickworth | last post by:
Can anyone explain polymorphism?(very simply). thanks richard
4
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...
2
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...
7
by: eric | last post by:
hello i'm confused by an example in the book "Effective C++ Third Edition" and would be grateful for some help. here's the code: class Person { public: Person(); virtual ~Person(); // see...
11
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++,...
17
by: Bart Friederichs | last post by:
Hello, I created the following inheritance: class Parent { public: void foo(int i); }; class Child : public Parent {
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.