0
How many times is constractor required to developer?
In my opinion, It's useful
4 Respostas
0
Constructor is used everytime you instantiate a class. Even if you don't see any constructor there. So it's essential.
0
constructor is called automatically when you make instance of that class....... constructor can be overloaded as much you want
0
Constructor is not required. If you do not declare any. Compiler automaticly generete defualt one without any parameters.
0
based on requirements you can use.
let me give you one example that will be useful to understand.
suppose , you have multilingual web site or Windows form project.
now. when the user will logon to web or form application that he/she want to choose language.
because in which language you want to open your site.
so that time I will create constructor of whatever page will open after logon and choose Language.
and you will get output on your chosen language.
class Farmer
{
Farmer()
{
Decorate():
}
private void Decorate()
{
// your preferred Lang. code goes here.
}
}