oop - Can we create a abstract class without using abstract keyword? -
this question asked interviewer in 1 of interviews.
we can avoid creating instance of class using private constructor cannot inherit class
thanks in advanve
well can use private constructor, not make class abstract.
it means other classes cannot create new instance of class.
but class can still call own constructor through static method, therefore creating new instance of itself.
if don't want class instanciated @ all, never ever, use abstract keyword...
Comments
Post a Comment