why we use constructer in c# ?
where we use it in realtime?
please send the answers for both questions!
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jaipal ReddyPosted Jun 26, 2015, 12:46 AM
Rajeesh MenothPosted Jun 26, 2015, 12:12 AM
Jignesh TrivediPosted Jun 25, 2015, 11:50 PM
Bhushan BhasmePosted Jun 25, 2015, 11:27 PM
A class may have multiple constructors that take different arguments. Constructors enable the programmer to set default values, limit instantiation, and write code that is flexible and easy to read.
When we create a object of class constructor gets automatically called.
There Are Three Types Of Constructors
1]Parameterless constructor
when You write any class and creates its object and provide parameterless constructor but donot provide any parameters then parameterless constructor gets called.
2]Parameterised constructor
when You write any class and creates its object and provide Parameterised constructor but provide any parameters then parameterised constructor gets called.
2]Default constructor
when You write any class and creates its object and do not provide constructor Default constructor gets called.
Hope this will help You
Pankaj Kumar ChoudharyPosted Jun 25, 2015, 11:27 PM
Pradeep ShetPosted Jun 25, 2015, 3:07 PM