We define a constructor private in the following scenarios:-
• We want to restrict the client to not create objects.
• In case of singleton patterns where we want only instance of the object to be created.
Below is a simple video which explains the above concept practically.
Please click here to see more Most asked c# interview questions
• We want to restrict the client to not create objects.
• In case of singleton patterns where we want only instance of the object to be created.
Below is a simple video which explains the above concept practically.
Please click here to see more Most asked c# interview questions
No comments:
Post a Comment