0
If l use two constractor with different type like string and int but both have only one variable this give error or not?
3 odpowiedzi
+ 8
You might want to give a sample code / more info to better illustrate a model of the problem. Is this C++?
+ 2
You can read this for more information: https://www.csee.umbc.edu/~chang/cs202/Lectures/modules/m04-overload/slides.php?print
Constructors are functions, so they follow the same rules.
The rules applied for C/C++ and Java, maybe C# as well.
0
normally you have to define the type of the given variable, so you can create 2 Constructors IF the given types differ from each other.
At least this is for Java and I guess it's applicable for C++/C# as well