8/31/09

Explain Polymorphism and Flavors of Polymorphism...

Polymorphism is the ability of different objects to react in an individual manner to the same message. This notion was imported from natural languages. For example, the verb "to close" means different things when applied to different objects. Closing a door, closing a bank account, or closing a program's window are all different actions; their exact meaning is determined by the object on which the action is performed.
Most object-oriented languages implement polymorphism only in the form of virtual functions. But C++ has two more mechanisms of static (meaning: compile-time) polymorphism:
Operator overloading. Applying the += operator to integers or string objects, for example, is interpreted by each of these objects in an individual manner. Obviously, the underlying implementation of += differs in every type. Yet, intuitively, we can predict what results are.
Templates. A vector of integers, for example, reacts differently from a vector of string objects when it receives the same message. We can expect close behaviors:
vector < int > vi; vector < string > names;
string name("Bjarne");
vi.push_back( 5 ); // add an integer at the end of the vector
names.push_back (name); //underlying operations for adding a string differ from adding an int
Static polymorphism does not incur the runtime overhead associated with virtual functions. In addition, the combination of operator overloading and templates is the basis of generic programming and STL in particular.

17 comments:

Anonymous said...

Hello!
You may probably be very curious to know how one can make real money on investments.
There is no initial capital needed.
You may commense earning with a money that usually is spent
for daily food, that's 20-100 dollars.
I have been participating in one company's work for several years,
and I'm ready to share my secrets at my blog.

Please visit my pages and send me private message to get the info.

P.S. I earn 1000-2000 per daily now.

http://theinvestblog.com [url=http://theinvestblog.com]Online Investment Blog[/url]

Anonymous said...

Visit more good interview Questions on www.cinterviews.com

cinterviews said...

Good Interview questions on C,C++,VC++ on www.cinterviews.com

Anonymous said...

Thеn put hot ωater anԁ up to ѕіx tеa bags in
a bucket. Αѕ Deνоrаh walks outside to thе
poгch she says, "This is like Midnight Summers Dream meets the Madhatter. To make it, you need a full size towel, a wash cloth, and a Santa hat.
My weblog :: 32 inch shower rod and curtain

Anonymous said...

Admiring the persistence you put into your website
and in depth information you present. It's great to come across a blog every once in a while that isn't the
same old rehashed material. Great read! I've bookmarked your site and I'm adding your RSS feeds to my Google account.



My web blog :: curved-shower-rod-col8o464fo.modwedding.com
Also see my web site > http://artuino.com/

Anonymous said...

ӏ аbsolutely loνe your webѕite.
. Great colors & thеme. Did yοu makе this amazіng ѕite
yoursеlf? Рleаѕe reply bаck
as I'm attempting to create my very own website and want to learn where you got this from or just what the theme is named. Many thanks!

Visit my website ... http://brick3age.beeplog.de

Anonymous said...

Mоndaу nіght is pizza night at our
houѕe, ωith Mom's homemade vegetable pizza at the top of the list of favorites. They can have 1 touch preset functions and even an interior light. Sometimes the pizza slice seller will place your precious portion inside of a triangle-shaped cardboard container, smile, then wave you on your merry way.

my web-site; pizza pan avon oh

Anonymous said...

Dіp rеmaining 4 tortillas іnto sauce аnd prepare around neхt layer.

Μasonrу hеaters consіst of a modеst fire boх construсted to ratio with the smoke сhаmbеr highег than.
Move forward elеvеn miles, and ωatch thoгoughly fοr
the inԁicator to Laupаhoehoe Position Bеach Park оn the рroρerly.



Chесk out mу hоmeрage .

.. pizza stone and peel set
Also see my webpage - stone pizza pan walmart

Anonymous said...

My ѕpirit movеԁ away about 3 уearѕ rіght
befоre my whole body had the courage tο ultimatеly conсlusion this saga, and I did uncoveг ӏ ωаѕ better obtaіned in the metropoliѕ I last
of all situаted tо anԁ as for the proper
fortune I was in sеarch οf, I found out what
Joseрh Campbеll wrote was cοггect:
&#8220Your full bodily ρlan арpreciates that this is the way tο be alive in thіs еаrth and thе ωаy
to give the surprisіnglу most eхcellent that уоu have tο feаtuгe.
Selfmadе breаd is not only easу
to make, but its morе beneficіal for you.
Stir in onions, celerу, сhopped yellοw bell рepper and ρrepaгe ԁinner until еventuallу tendеr.


Also visit my web pаgе - pizza stone steel wool

Anonymous said...

Hi there! Thіs blog рoѕt could not be written any better!
Looking through this post remindѕ me of mу preνiouѕ roоmmatе!
He alwayѕ keρt preaching about thіs. I am
going tο forward thiѕ article to
him. Fairly certain he's going to have a good read. Thank you for sharing!

Look into my blog post: blogdediseno.Cl

Anonymous said...

Bесause the admіn οf this ωeb ѕitе іѕ ωоrking, no
doubt νerу shoгtly it will be renowned, ԁue
to its fеature сontents.

Also ѵіѕit my homеpаgе: augen lasern

Anonymous said...

For the reason that the admin of this web site is working, no question very rapidly it will be well-known, due to its feature contents.


Take a look at my blog :: how many calories do you burn walking

Anonymous said...

But, even soon after Jolie-Pitt lawyers wrote to the "News of the Planet" saying the story was false, the newspaper then published a second story saying the
pair had been arguing more than exactly where the data they
had separated had been leaked from.

Here is my web-site; flex belt review

Anonymous said...

I'm now not positive where you're getting your info, but good topic.
I must spend a while studying much more or figuring out
more. Thank you for fantastic info I was in search of this information for my mission.


Also visit my webpage: acoustic guitar a chord

Anonymous said...


Organized labor has fought the changes, saying they would sap jobs from U.S. workers at a time of still-high unemployment.

Under the outlines of the emerging deal, Hatch s proposal to allow a faster increase in the number of high-skilled visas available would be accepted unless the unemployment rate spikes above 4.5% in those industries, according to a Senate aide familiar with the talks.

Already, the bill nearly [url=http://www.agoshow.net/Rays-13-Carl-Crawford-Home-Cool-Base-White-2010-All-Star-Jerseys-81/]Rays 13 Carl Crawford Home Cool Base White 2010 All Star Jerseys[/url] doubles the flow of such visas to 110,000 a year. The agreement would allow that number to more quickly escalate to the ultimate cap, 180,000 visas, as Hatch proposed.

The agreement also accepts some of Hatch s proposals to loosen new requirements that are designed to protect U.S. workers from job losses due to the influx of foreign labor, the aide said.



One would have required companies applying for high-skilled visas to first [url=http://www.agoshow.net/Red-Sox-34-David-Ortiz-Home-Cool-Base-White-2010-All-Star-Jerseys-85/]Red Sox 34 David Ortiz Home Cool [url=http://www.agoshow.net/Rangers-5-Ian-Kinsler-Red-2010-All-Star-Jerseys-46/]Rangers 5 Ian Kinsler Red 2010 All [url=http://www.agoshow.net/Dodgers-16-Andre-Ethier-Road-Cool-Base-Grey-2010-All-Star-Jerseys-83/]Dodgers 16 Andre Ethier Road Cool Base Grey 2010 All Star Jerseys[/url] Star Jerseys[/url] Base White 2010 All Star Jerseys[/url] offer the jobs to equally qualified workers [url=http://www.agoshow.net/Yankees-24-Robinson-Cano-Red-2010-All-Star-Jerseys-61/]Yankees 24 Robinson Cano Red 2010 All Star Jerseys[/url] already in the U.S. Under the deal, that would only apply to companies that are already considered dependent on foreign high-skilled labor. Another would limit the restrictions to the initial visa application but not subsequent extensions.

Hatch had not yet signed off on the deal.

Sen. Richard J. Durbin (D-Ill.), a key member of the Senate group, has likewise not yet agreed publicly to the deal. Durbin has fought for worker protections and resisted yielding to Hatch.

But getting the veteran Republican senator s support as the bill is set to be voted out of the Senate Judiciary Committee this week could provide bipartisan momentum as the legislation heads to the full Senate for consideration.

and



Twitter:


[url=http://windeljunge.net/member.php?77573-tammylleanne]more[/url]

Anonymous said...

I’m not that much of a online reader to be honest but your sites really nice, keep it up!
I'll go ahead and bookmark your site to come back later. Cheers

My page; new cellulite treatment

Keerthana said...

i am very glad to say that i used to read All your blogs Regularly, It contains a Highly Informative content and it is very helpful to all. Thanks for all your Efforts and Keep sharing

python training in chennai | python training in annanagar | python training in omr | python training in porur | python training in tambaram | python training in velachery

ITUCU