6
Answers

oops Concept question

Constructor return a value or not ?
if return what is return ? 

Answers (6)

3
Photo of Bipul tiwari
1.4k 288 7 7y
A Constructor can not return anything and we can't write void keyword also.
 
For more detail please refer the below URL
 
http://www.agrini-tricks.in/Tutorial/constructor-in-csharp-with-example-type-of-constructor.aspx 
 
3
Photo of Ravi Kiran Chanduri
631 1.5k 1.4m 7y
Hey Anoop,
 
Technically Constructors doesn't return any value. Please go through the following link.
 
http://www.aspdotnet-suresh.com/2013/09/csharp-constructor-example-types-of-constructor-in-csharp.html 
3
Photo of Nitin Sontakke
137 13.6k 15.4k 7y
Constructor does (technically) return a value, which is the instance of the class in which it is defined. Because the type of the returned value is by definition always an instance of a class in which constructor is defined it is never explicitly mentioned as it is meaningless to say so.
 
So it does return a value and it always an instance of a class in which it defined. But because it is such a standard, it is never mentioned.
 
To give you a crud example, you say that "Prakash is my brother and his gender is male". How does that sound?
 
2
Photo of Bharathi Raja
NA 1.1k 57.6k 7y
refer the link:
https://social.msdn.microsoft.com/Forums/vstudio/en-US/2ec6fb3f-dd67-48c5-9655-1c479323fafa/can-a-constructor-return-a-value?forum=csharpgeneral 
2
Photo of Laxmidhar Sahoo
NA 10.4k 55.9k 7y
No sir constructor sioes not return .but it assign the value to members
2
Photo of Ramesh Palanivel
204 9.6k 1.5m 7y
HI Anoop,
 
Constructor doen't have any return type and not even void.
 
To know more about contructor Please refer the below URL,
 
http://www.c-sharpcorner.com/UploadFile/0c1bb2/constructors-and-its-types-in-C-Sharp/