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 -

Laravel mail error `Swift_TransportException in StreamBuffer.php line 269: Connection could not be established with host smtp.gmail.com [ #0]` -

c# SetCompatibleTextRenderingDefault must be called before the first -