Yesterday I was reading PHP classes and suddenly something got weird to me. And that was about constructors in C# and PHP.
My question is what is constructor? Isn't it a special methods, used when instantiating a class that can does something like a method and take necessary resources for class like Memory and etc? And if it is, for example when we have a parent class named A which we derive another class named B and create an instance of B and call the B constructor and send some arguments to its parent (A) use :base(args.) (in C#) and use parent::__construct(args) (in PHP) , so is it goes and call the parent constructor , we don't want to exactly take resources for the parent but we just call the parent constructor which do it's for us. What happen exactly here?
I guess in this case simply just called it like a function! :\ i don't know i made my self clear or not ... Ask me if there is any Ambiguity, and Thanks ;)
UPDATED Thank by giving me the negative vote by the way ... look at this link : Microsoft Docs as far i read here it's something more than a simple function which hold a block of codes.(but with differences which you said , no return value and etc.) if it is just a function which called when an instance get created so why if we make it private then we can not make any instance of it anymore? why when we wanted to create a class add a () at the end of the class name?and when we want to pass any args to constructor use those () to send ? [Person new_person = new Person();] if you think also this a question which doesn't show any effort , vote negative again :D