Programming Concepts Question:
Download Job Interview Questions and Answers PDF
Explain how to write a class in c++ using only one object?
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