can you give real time example for polymarphism
Answers were Sorted based on User's Feedback
Answer / lavanya
I am daughter for my parents,sister for my sibling, and also
a employee for my employer...am one but acting different in
different scenario....
| Is This Answer Correct ? | 15 Yes | 0 No |
Answer / venki
Appearing different forms of water
once it acts as ice
and other vapour
| Is This Answer Correct ? | 4 Yes | 0 No |
Answer / rama
Shape
draw()
it may consists of:
1.Circle object
Draw(circle)
2.Box object
Draw(box)
3.Triangle object
Draw(triangle)
| Is This Answer Correct ? | 0 Yes | 0 No |
Write a program to get the binary tree.
what is oppes
What is polymorphism give a real life example?
#include <iostream> using namespace std; struct wow { int x; }; int main() { wow a; wow *b; a.x = 22; b = &a; a.x = 23; cout << b->x; return 0; }
what do you mean by static member variable?
What is the difference between a constructor and a destructor?
What is encapsulation in simple terms?
Question In a class, there is a reference or pointer of an object of another class embedded, and the memory is either allocated or assigned to the new object created for this class. In the constructor, parameters are passed to initialize the data members and the embedded object reference to get inialized. What measures or design change should be advised for proper destruction and avioding memory leaks, getting pointers dangling for the embedded object memory allocation? Please suggest. Question Submitted By :: Sunil Kumar I also faced this Question!! Rank Answer Posted By Re: In a class, there is a reference or pointer of an object of another class embedded, and the memory is either allocated or assigned to the new object created for this class. In the constructor, parameters are passed to initialize the data members and the embedded object reference to get inialized. What measures or design change should be advised for proper destruction and avioding memory leaks, getting pointers dangling for the embedded object memory allocation? Please suggest. Answer # 1 use copy constructors 0 Shanthila There is something to be taken care in destructor, in copy constructor, suppose the memory is assigned to the embedded member object pointer with the parameter passed value, but if some other objects of different class also are pointing to this memory, then if some one deletes the object then this class member pointer object will become dangling, or if the object is not deleted properly then there will be memory leak. Please suggest the design change required to handle or avoid this situation
What is polymorphism? Explain with an example.
What is interface? When and where is it used?
why to use operator overloading
DIFFRENCE BETWEEN STRUCTURED PROGRAMING AND OBJCET ORIENTED PROGRAMING.