i want to know the definition of Polymorphism with example for my exam.
thankz
from
taj
6 1293
for my exam, i want "Five reasons of using constant variable or constant identifier".
please quick and help me now.
thankz
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?
Yes ,i just want to know about that for my exam .
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.
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.
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.
Sign in to post your reply or Sign up for a free account.
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: 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,...
| |
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...
|
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...
|
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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 ...
|
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...
| |