Capgemini Engineering Interview Question

How to create an class which is being initiatzed based on some conditions?