24 questions
0
votes
1
answer
140
views
Cpp compiler chooses the wrong constructor [duplicate]
Got a parametrized constructor which accepts size_t variables, and therefore should be called when trying to create an object passing a size_t variable. Instead, compiler tries to call the ...
2
votes
3
answers
431
views
Why do we still need to implement 'noArgsConstructor' if Java gives a non-parameterized constructor by default?
In Spring boot if we are creating a POJO class and we end up creating only a parameterized constructor and not any default constructor then Java will throw errors, why does this happen if Java ...
0
votes
0
answers
75
views
What does `const&` mean in `const char* const& _str`? [duplicate]
This is a constructor of class MyString:
MyString(const char* const& _str = nullptr);
Inside it, we give const char * and then again const& and then _str, what does const& mean here?
1
vote
0
answers
73
views
Using a constraint with a parmeterized constructor in Spring Boot application
I have a Spring Boot application where an interface has a constraint:
@Constraint(
validatedBy = {
MyValidator.class
})
public @interface MyInterface {
...
}
I'm using Togglz to ...
4
votes
1
answer
164
views
Julia parametric constructor and incomplete initialization
I'm new to programming in Julia (I'm coming from Java) and some Julia concepts are still difficult to understand to me. What I intend is to replicate this Java code:
public class Archive<T extends ...
1
vote
0
answers
41
views
Proguard doesn't keep access modifier in parameterized constructor
I have following class A
Class A {
public A(String param1, String param2)
// body
}
public A(String param1, String param2, String param3)
// body
}
}
My proguard settings
keep 'public ...
0
votes
2
answers
248
views
Creating a parameterized constructor to determine upper bound for randomized side lengths
Im working on a project for class and we have to create a Triangle class that will hold the lengths of each side of the triangle. I created a default constructor that gives each side of the triangle a ...
-2
votes
1
answer
611
views
Different ways to initialize object field with parameter [closed]
What other ways are there to initialize the class field "fieldList" based on a given List object?
One way would be Parameterized constructor.
class ObjectA {
private List<String> ...
-2
votes
2
answers
652
views
If final variable is initialized in parameterized constructor dynamically, then it breaks final rule
If final variable is initialized in parameterized constructor and data is assigned through constructor args then final value seems to be changing here for every object.
public class Test {
final int ...
1
vote
0
answers
120
views
Parameterized MVC6 WebApi constructor not calling using Ninject
I am Using MVC6- WebApi Parameterized constructor not calling. I referenced Ninject the below reference.
http://sudiptachaudhari.com/dependency-injection-aspnet-webapi/
WebApi Controller
public ...
1
vote
1
answer
60
views
when is it obligatory to define constructors in subclasses?
trying to inherit array adapter class it gives me an error when not defining a constructor in subclass....why should I define a constructor
public class WordAdapter extends ArrayAdapter<word> {
...
1
vote
2
answers
4k
views
Pytests: getting error function uses no argument error
I have following code:
@pytest.fixture
def mock_path_functions(mocker, file_exists=True, file_size=10):
mock_obj = mock.Mock()
mock_obj.st_size = file_size
mocker.patch("os.path....
-1
votes
1
answer
413
views
Why default constructor is not provided by compiler when class contains parametrized constructor defined by user? [duplicate]
I am a newbie in java and was wondering "Why default constructor is not provided by compiler when class contains parametrized constructor defined by user?"
2
votes
2
answers
1k
views
Instantiating class with interfaces in c#
Hi this might be trivial but I am trying to understand the class instantiation using interface. So below is my code:
public interface IRepository
{
string GetMemberDisplayName();
}
public class ...
1
vote
1
answer
562
views
NUnit: How can I set name of test depending on parametr in [TestFixture(typeof(param))]
I'm using NUnit + Webdriver + C#. Setup class has next stucture:
[TestFixture(typeof(InternetExplorerDriver))]
[TestFixture(typeof(ChromeDriver))]
public partial class SetupBase<TWebDriver> ...