How to construct muliton object
Answers were Sorted based on User's Feedback
Answer / som shekhar
Multiton pattern is similar to singleton pattern but it
keeps the named instances in a key value pair.
In singleton pattern, the class will have only one instances
but in the multiton pattern it manages a map of named instances.
| Is This Answer Correct ? | 1 Yes | 0 No |
Read the following program carefully and write the output of the program. Explain each line of code according to given numbering. #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <errno.h> 1……………… int main (void) { pid_t pid; 2………………………… pid = fork(); 3…………………………. if (pid > 0) { int i; 4………………………… for (i = 0; i < 5; i++) { 5………………… …………… printf(" I AM VU : %d\n", i); 6………………… …………… sleep(1); } exit(0); } 7………………… ……… else if (pid == 0) { int j; for (j = 0; j < 5; j++) { 8……………………………… printf(" I have no child: %d\n", j); sleep(1); } _exit(0); } else { 9………………………………fprintf(stderr, "can't fork, error %d\n", errno); 10……………… … ………… exit (EXIT_FAILURE); } }
Write a program to calculate the BMI of a person using the formula BMI = weight/height2.
How would you use the functions memcpy(), memset(), memmove()?
Which of the Standard C++ casts can be used to perform a ?safe? downcast: a) reinterpret_cast b) dynamic_cast c) static_cast d) const_cast
If a round rectangle has straight edges and rounded corners, your roundrect class inherits both from rectangle and from circle, and they in turn both inherit from shape, how many shapes are created when you create a roundrect?
When copy constructor can be used?
How do I tokenize a string in c++?
how to explain our contribution in the project?
Is swift better than c++?
How to implement flags?
Comment on local and global scope of a variable.
I was a c++ code and was asked to find out the bug in that. The bug was that he declared an object locally in a function and tried to return the pointer to that object. Since the object is local to the function, it no more exists after returning from the function. The pointer, therefore, is invalid outside.