All Questions
5 questions
-2
votes
1
answer
300
views
Why aren't constructors atomic? [closed]
If thrown exceptions in constructors can lead to memory leaks or partially-constructed objects, then why we don't make them atomic? so neither an object nor it's local variables will get created/...
1
vote
2
answers
333
views
Performing serial communication in constructor to initialize an object
I have a class UnitInfo which represents a collection of unit information with methods to get the unit information in a structured way, such as a specific encoding, etc. This unit info consists of ...
2
votes
4
answers
872
views
What do OOP languages gain from having constructors that always return an object?
In what seems like a deliberate design decision, C++ does not have a null value for objects and references. This makes using objects and references very elegant since we don't have to perform null ...
10
votes
2
answers
847
views
Is it bad to create classes whose sole purpose is to be converted to another class implicitly?
Imagine a situation where we're using a library that allows you to create Circle objects, where you can specify the radius and the center of the circle to define it. However, for some reason, it also ...
-5
votes
1
answer
4k
views
pass a variable as parameter to constructor c# [closed]
pass a variable as parameter to constructor as i want to change the variable value with changeable value
i'm new to c# so that i tries to implement one thing in many way i did what i want to do with ...