Lê Duy Quang
Lê Duy Quang
CC#
Created by tommy on 10/19/2024 in #help
✅ difference between `MyClass obj2 = obj1;` and `MyClass obj2 = new MyClass(obj1);`
I mean follow a proper course.
47 replies
CC#
Created by tommy on 10/19/2024 in #help
✅ difference between `MyClass obj2 = obj1;` and `MyClass obj2 = new MyClass(obj1);`
My advice is then don't skip lessons.
47 replies
CC#
Created by tommy on 10/19/2024 in #help
✅ difference between `MyClass obj2 = obj1;` and `MyClass obj2 = new MyClass(obj1);`
int here is a value type, not mutable.
47 replies
CC#
Created by tommy on 10/19/2024 in #help
✅ difference between `MyClass obj2 = obj1;` and `MyClass obj2 = new MyClass(obj1);`
That's putting a brand new value into the field.
47 replies
CC#
Created by tommy on 10/19/2024 in #help
✅ difference between `MyClass obj2 = obj1;` and `MyClass obj2 = new MyClass(obj1);`
How?
47 replies
CC#
Created by tommy on 10/19/2024 in #help
✅ difference between `MyClass obj2 = obj1;` and `MyClass obj2 = new MyClass(obj1);`
Is int mutable?
47 replies
CC#
Created by tommy on 10/19/2024 in #help
✅ difference between `MyClass obj2 = obj1;` and `MyClass obj2 = new MyClass(obj1);`
This can be sufficiently regarded as a deep copy because string is immutable.
47 replies
CC#
Created by tommy on 10/19/2024 in #help
✅ difference between `MyClass obj2 = obj1;` and `MyClass obj2 = new MyClass(obj1);`
Still, it's up to that constructor what kind of copy it is.
47 replies
CC#
Created by tommy on 10/19/2024 in #help
✅ difference between `MyClass obj2 = obj1;` and `MyClass obj2 = new MyClass(obj1);`
It's the code in that constructor.
47 replies
CC#
Created by tommy on 10/19/2024 in #help
✅ difference between `MyClass obj2 = obj1;` and `MyClass obj2 = new MyClass(obj1);`
It's not related to the compiler.
47 replies
CC#
Created by tommy on 10/19/2024 in #help
✅ difference between `MyClass obj2 = obj1;` and `MyClass obj2 = new MyClass(obj1);`
what the constructor does isn't known, it may be trying to copy, or it may be doing something else.
47 replies
CC#
Created by tommy on 10/19/2024 in #help
✅ difference between `MyClass obj2 = obj1;` and `MyClass obj2 = new MyClass(obj1);`
Again that code isn't related to copying.
47 replies
CC#
Created by tommy on 10/19/2024 in #help
✅ difference between `MyClass obj2 = obj1;` and `MyClass obj2 = new MyClass(obj1);`
The second one makes a new instance, what the constructor does isn't known, it may be trying to copy, or it may be doing something else.
47 replies
CC#
Created by tommy on 10/19/2024 in #help
✅ difference between `MyClass obj2 = obj1;` and `MyClass obj2 = new MyClass(obj1);`
It's not a name, it's a variable whose value is a reference to that instance.
47 replies
CC#
Created by tommy on 10/19/2024 in #help
✅ difference between `MyClass obj2 = obj1;` and `MyClass obj2 = new MyClass(obj1);`
One just makes the variable hold the same instance as the original and one makes a new instance with the original as an argument.
47 replies
CC#
Created by tommy on 10/19/2024 in #help
✅ difference between `MyClass obj2 = obj1;` and `MyClass obj2 = new MyClass(obj1);`
That has little to do with shallow or deep copy.
47 replies
CC#
Created by lemon on 9/8/2024 in #help
error CS0506. How to fix?
That's mentioning the original method in Interactable.
11 replies
CC#
Created by lemon on 9/8/2024 in #help
error CS0506. How to fix?
Yes, that's why you cannot override.
11 replies
CC#
Created by lemon on 9/8/2024 in #help
error CS0506. How to fix?
Well that method cannot be overridden.
11 replies
CC#
Created by lemon on 9/8/2024 in #help
error CS0506. How to fix?
Show the full error message.
11 replies