4. What do you mean by a prototype? Define analysis
prototype
Answer / som shekhar
Prototype is creational design pattern similar to abstract
factory pattern.
Most of you know abstract factory pattern, in the prototype
pattern when you want to create a clone of an object of some
class, then instead of creating directly the clone that
means using new operator and step by step copying the
elements, or you will be calling the copy constructor of the
class.
But in the real time applications we dont want the copy
constructor to be called so it is made as private, and hence
you cannot copy the items, so this design patterns says that
if you want to create the clone of a class, keep the clone
fucntion as virtual in the base class and let the derived
class implement...this is one aspect.
| Is This Answer Correct ? | 2 Yes | 0 No |
When a private constructer is being inherited from one class to another class and when the object is instantiated is the space reserved for this private variable in the memory??
Why is polymorphism used?
Which is faster post increment or pre increment ? and in which cases should u use either - to increase speed?
What is OOPS and How it is different from Procedural Programming ?
23 Answers HP, Infosys, Thyrocare,
What is and I oop mean?
explain defference between structure and class with example
Finding of the 4 larger (bigger) numbers from the list like{1245,4587,2145,1163,29987,65783.....}
oops concept is used for?
What are virtual classes?
#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; }
the difference between new and malloc
In c++ there is only virtual destructors, no constructors. Why?