Top "Object-construction" questions

For questions related to object construction, usually in an OOP environment.

How can I initialize C++ object member variables in the constructor?

I've got a class that has a couple of objects as member variables. I don't want the constructors for these …

c++ constructor class-members object-construction
Why should I prefer to use member initialization lists?

I'm partial to using member initialization lists with my constructors... but I've long since forgotten the reasons behind this... Do …

c++ oop object-construction
How do I use Powermockito to mock the construction of new objects when testing a method in an anonymous class?

I woud like to write a JUnit test to verify that the code below uses a BufferedInputStream: public static final …

java mockito anonymous-class powermock object-construction
How do I initialize classes with lots of fields in an elegant way?

In my application, I have to instantiate many different types of objects. Each type contains some fields and needs to …

java coding-style builder code-cleanup object-construction
Does Java have a default copy constructor (like in C++)?

Does Java has a default copy constructor as C++? If it has one - does it remain usable if I …

java c++ copy-constructor language-comparisons object-construction
Is Java slow when creating Objects?

In my current project (OpenGL Voxel Engine) I have a serious issue when generating models. I have a very object …

java performance oop new-operator object-construction