4. What do you mean by a prototype? Define analysis
prototype



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

Post New Answer

More OOPS Interview Questions

What do you mean by inline function?

6 Answers  


What is polymorphism in oops with example?

0 Answers  


char* ptr = "Rahul"; *ptr++; printf("%s",ptr); What will be the output

9 Answers   Persistent,


class CTest { public: void someMethod() { int nCount = 0; cout << "This is some method --> " << nCount; } }; int main() { CTest *pctest; pctest->someMethod(); return 0; } It will executes the someMethod() and displays the value too. how is it possible with our creating memory for the class . i think iam not creating object for the class. Thanks in Advance... Prakash

0 Answers  


Can abstract class have normal methods?

0 Answers  






Is following functions are said to be overloaded? int add(int a,int b) char *add(int a,int b)

4 Answers  


write a program in c++ to overload the function add (s1,s2) where s1 and s2 are integers and floating point values.

4 Answers  


What is inheritance in oop?

0 Answers  


Why and when is a virtual destructor needed?

5 Answers  


what is Class in oops with example?

4 Answers   HCL,


What is a template?

7 Answers  


What is function overloading?,describe it with the example.

5 Answers  


Categories