Question and answer
What is an example of polymorphism
Polymorphism : A phenomenon which enables an object to react differently to the same function call. [ In C++ it is attained by using a keyword virtual. Example : public class SHAPE { public virtual void SHAPE::DRAW()=0; } Note here the function DRAW() is pure virtual which means the sub classes must implement the DRAW() method and SHAPE cannot be instatiated public class CIRCLE::public SHAPE { public void CIRCLE::DRAW() { // TODO drawing circle } } public class SQUARE::public SHAPE { public void SQUARE::DRAW() { // TODO drawing square } } now from the user class the
calls would be like globally SHAPE *newShape; When user action is to draw public void MENU::OnClickDrawCircle(){ newShape = new CIRCLE(); } public void MENU::OnClickDrawCircle(){ newShape = new SQUARE(); } the when user actually draws public void CANVAS::OnMouseOperations(){ newShape->DRAW(); } ]
Expert answered|jeifunk|Points 8603|
Question
Asked 2/6/2013 12:52:29 PM
0 Answers/Comments
This answer has been confirmed as correct and helpful.
s
Get an answer
New answers
Rating

There are no new answers.

Comments

There are no comments.

Add an answer or comment
Log in or sign up first.
Questions asked by the same visitor
What is polymorphism
Weegy: Polymorphism refers to a programming language's ability to process objects differently depending on their data type or class. (More)
Question
Expert Answered
Asked 2/6/2013 1:23:18 PM
0 Answers/Comments
write the equation of the line which has a slope of 7 and passes through (2,3).
Weegy: The equation of the line which has a slope of 7 and passes through (2,3) is y=7x-11. (More)
Question
Expert Answered
Asked 2/11/2013 2:45:20 PM
0 Answers/Comments
31,735,807
questions answered
GET
Answers.
GET THE APP.
weegy*
*
Get answers from Weegy and a team of really smart live experts.
Popular Conversations
A_____can be used in the Senate to stop a bill from being passed.
Weegy: A filibuster can be used in the Senate to stop a bill from being passed. User: One main difference between ...
5/22/2020 6:01:14 AM| 5 Answers
Is the following sentence using a parenthetical expression correctly? ...
Weegy: f course, the girls, couldn't wait to jump in the pool on such a hot day.
5/26/2020 4:04:32 PM| 4 Answers
What is the primary purpose of photosynthesis
5/26/2020 1:56:07 PM| 4 Answers
Colors of German flag
5/25/2020 3:49:24 PM| 4 Answers
Cirrhosis of the liver is an effect of
Weegy: Cirrhosis of the liver is an effect of long term alcohol use.
5/24/2020 6:30:38 AM| 4 Answers
Which NIMS Management Characteristic helps to eliminate confusion ...
Weegy: The National Incident Management System (NIMS) is a standardized approach to incident management developed by ...
5/29/2020 7:29:09 PM| 3 Answers
The need for ______________ can complicate information sharing among ...
Weegy: The need for Advanced Equipment can complicate information sharing among emergency personnel.
5/22/2020 2:48:19 PM| 3 Answers
Shhare your window.
W I N D O W P A N E
FROM THE CREATORS OF
weegy
WINDOWPANE is the live-streaming social network that turns your phone into a live broadcast camera for streaming to friends, family, followers, or everyone. Share what’s outside your window and all around you. Earn a little too.
Top Windowpane Earnings
$547.00
Hearts 13,373 Views 5,718,577 Streams 1,339
$528.00
Hearts 12,453 Views 5,340,578 Streams 1,280
$480.35
Hearts 9,911 Views 5,424,852 Streams 1,272
$428.30
Hearts 9,233 Views 1,719,036 Streams 430
$425.45
Hearts 9,875 Views 6,174,173 Streams 1,392
$391.10
Hearts 7,977 Views 4,895,692 Streams 1,202
$388.15
Hearts 8,147 Views 7,364,654 Streams 1,671
$375.50
Hearts 8,588 Views 4,463,853 Streams 1,095
S
L
Points 87 [Total 290] Ratings 0 Comments 87 Invitations 0 Online
S
L
Points 53 [Total 546] Ratings 0 Comments 53 Invitations 0 Offline
S
L
R
L
Points 40 [Total 5317] Ratings 0 Comments 40 Invitations 0 Online
S
L
P
R
P
R
L
P
P
C
R
Points 34 [Total 9481] Ratings 0 Comments 34 Invitations 0 Online
S
L
R
R
Points 28 [Total 2439] Ratings 0 Comments 28 Invitations 0 Offline
S
Points 15 [Total 36] Ratings 1 Comments 5 Invitations 0 Offline
S
L
Points 12 [Total 1923] Ratings 0 Comments 12 Invitations 0 Offline
S
L
Points 12 [Total 2673] Ratings 0 Comments 12 Invitations 0 Offline
S
L
Points 11 [Total 630] Ratings 0 Comments 11 Invitations 0 Offline
S
L
R
P
Points 7 [Total 2170] Ratings 0 Comments 7 Invitations 0 Offline
* Excludes moderators and previous
winners (Include)
Home | Contact | Blog | About | Terms | Privacy | © Purple Inc.