Programming Concepts Question:

Download Job Interview Questions and Answers PDF

Explain how to write a class in c++ using only one object?

Programming Concepts Interview Question
Programming Concepts Interview Question

Answer:

class singleten{ static int count; singleten() { if (count==1) { exit(0); } count++; }}singleten::count =0;void main(){singleten s1;singleten s2;}program is terminated as soon as second object is created.

Download Programming Concepts Interview Questions And Answers PDF

Previous QuestionNext Question
How to remove sections in report in reportnet?A function is running, it has its own stack pointer, memory area now it invokes another function from this point what changes will be in its memory area and what other changes in data segment, stack segment, heap segment. I want a complete picture of memory architecture?