C# Programming - Constructors - Discussion

Discussion Forum : Constructors - General Questions (Q.No. 1)
1.
Which of the following statements is correct?
A constructor can be used to set default values and limit instantiation.
C# provides a copy constructor.
Destructors are used with classes as well as structures.
A class can have more than one destructor.
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
18 comments Page 1 of 2.

Yogesh said:   6 years ago
C# does not provide a copy constructor but you can create on your own.
(1)

Naviddya Batra said:   7 years ago
C# also provides the copy constructor. So, the answer should be a and b.
(1)

Neeraj Sharma said:   1 decade ago
C# doesn't provide a copy constructor for objects, but you can write one yourself.

Eugene Asare said:   3 years ago
A copy constructor is a C# programming constructor Right?

Pravallika said:   9 years ago
C# provides copy constructor as it is a type of constructor.

David said:   10 years ago
Constructors is automatically invoked when the class objects is initiated.

Hema said:   1 decade ago
C# provides copy constructor also.

So, A and B both are correct.

Arul said:   1 decade ago
C# provide a copy constructor and C# class have more than one constructor. So answer B & D.

Bhavani said:   1 decade ago
C# doesn't provide copy constructor, every class have implicit constructor.

Sundar said:   1 decade ago
@Tulsi

Unlike some languages, C# does not provide a copy constructor. If you create a new object and want to copy the values from an existing object, you have to write the appropriate method yourself.

Source: http://msdn.microsoft.com/en-us/library/ms173116(v=vs.80).aspx


Post your comments here:

Your comments will be displayed after verification.