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

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -