473,513 Members | 2,319 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Polymorphism

5 New Member
i want to know the definition of Polymorphism with example for my exam.
thankz
from
taj
Jan 19 '07 #1
6 1293
taj22
5 New Member
for my exam, i want "Five reasons of using constant variable or constant identifier".
please quick and help me now.
thankz
Jan 19 '07 #2
Ganon11
3,652 Recognized Expert Specialist
What do you know about these problems? Is there anything you don't understand, or are you just looking for a quick 'A' on your exam?
Jan 19 '07 #3
taj22
5 New Member
Yes ,i just want to know about that for my exam .
Jan 19 '07 #4
taj22
5 New Member
What do you know about these problems? Is there anything you don't understand, or are you just looking for a quick 'A' on your exam?
i don't know about these problem.i want that just for my exam. please help me quick.
Jan 19 '07 #5
Ganon11
3,652 Recognized Expert Specialist
Well, Polymorphism is a critical concept that I can't fully explain. Basically, it is the ability to use subclasses and base classes. Suppose I was making a chess game. The board is full of chess pieces, but I can't be sure which piece is which. They'll all act similarly, though. I use a chessPiece class as an abstract base class, and use Rook, Pawn, King, etc classes as subclasses of chessPiece. In my main program, I can use methods common to all chessPieces on the members of the board, even though I don't know specifically which piece it is - in other words, I might use chessPiece.validateMove(), but if the chessPiece was a Rook, then the method executed would be Rook.validateMove().

As for constant identifiers, one big reason is that, if your program depends on constant variables, you can change that definition at the beginning of your program and alter the entire way your program runs - the alternative would be to find every time you used a hard coded number and change it.
Jan 19 '07 #6
taj22
5 New Member
thankz for ur reply
but i want just Theory of that definitions. For study .



Well, Polymorphism is a critical concept that I can't fully explain. Basically, it is the ability to use subclasses and base classes. Suppose I was making a chess game. The board is full of chess pieces, but I can't be sure which piece is which. They'll all act similarly, though. I use a chessPiece class as an abstract base class, and use Rook, Pawn, King, etc classes as subclasses of chessPiece. In my main program, I can use methods common to all chessPieces on the members of the board, even though I don't know specifically which piece it is - in other words, I might use chessPiece.validateMove(), but if the chessPiece was a Rook, then the method executed would be Rook.validateMove().

As for constant identifiers, one big reason is that, if your program depends on constant variables, you can change that definition at the beginning of your program and alter the entire way your program runs - the alternative would be to find every time you used a hard coded number and change it.
Jan 19 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

37
2790
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...
18
12555
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...
3
7423
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
5070
by: richard pickworth | last post by:
Can anyone explain polymorphism?(very simply). thanks richard
4
7379
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...
13
14590
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...
18
3836
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...
2
3368
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...
11
2946
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
3834
by: Bart Friederichs | last post by:
Hello, I created the following inheritance: class Parent { public: void foo(int i); }; class Child : public Parent {
0
7269
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
7177
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...
1
7123
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7542
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5100
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4756
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3237
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1611
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
470
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.