I want to force any class not to be able to create a new instance if it inherits a specific base class, so how this base class should look like?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The following code is in java. just to give you an Example
Base class has an exception on the constructor.
The child class extending the base class but if you create an object of it it will give u an exception.