21,142
questions
0
votes
1
answer
14
views
Got "expected type specifier" error while instantiating my property
My goal is to create nullable value which takes both a default value function and a key to retrieve a potential customization of the value from the flash storage.
But trying to instantiate it as a ...
-2
votes
0
answers
20
views
Should I use member or non-member functions when breaking constructors in Go? [closed]
Suppose I have a big, complex struct Foo.
type Foo struct {
// a big, complex object...
}
It will be created with the constructor function NewFoo(). Since the object is big and complex, NewFoo() ...
0
votes
0
answers
31
views
Make Auth::id() availeble in other midleware in Laravel 11
In Laravel 11 a middleware is called in the constructor of a controller.
The controller:
<?php
namespace App\Http\Controllers;
use Illuminate\Support\Facades\Auth;
use Illuminate\Http\Request;
...
0
votes
0
answers
77
views
data validation in constructors c++ [closed]
Is it better or not to verify data using a constructor while creating the object?
The user is not allowed to create an object until he enters correct data
Is this true or no?
Is there a better way ...
0
votes
0
answers
18
views
How to properly infer the Constructor of an object through JSDoc?
I want to make this function that receives a parameter and return its class if object, the parameter itself if function or the legacy object constructor if anything else.
In JavaScript the example ...
1
vote
1
answer
58
views
self inside Lua constructors
Sorry it's not quite a specific question.
In the "Programming in Lua, 4th edition" one can see the following code :
Account = {balance = 0}
function Account:new (o)
o = o or {}
self....
1
vote
1
answer
63
views
Transfer the ownership of a already-defined std::unique_ptr to the member of a class object
I am trying to transfer the ownership of a already-defined std::unique_ptr to the member of a class object:
#include <iostream>
#include "memory"
// base class
class base
{
public:
...
1
vote
1
answer
40
views
StackOverflowError when constucting a struct from another in Julia
I get a StackOverflowError when I try to build a struct object from another, previously existing one in which one of the parameters depends on the others.
I define a type like the following:
using ...
0
votes
1
answer
33
views
How to validate user input and verify atrributes applied correctly?
I am working on a code that does checks for various things. Everything in the code works fine, except there is two checks it is failing according to my instructer, and I am not seeing where I am ...
1
vote
0
answers
26
views
C++: Catching an exception thrown by a constructor of a parent class within a derived class [duplicate]
I have a base class, which throws an exception in the constructor. I call this constructor from the child constructor, but can't catch within the derived constructor the exception that is thrown from ...
0
votes
0
answers
22
views
Why can't I define a key value in parent constructor if it's not in the child one
Why can't I put species in the constructor here but outside it is allowed? What can be done to fix this? For example,
class Humans {
constructor(nameGiven) {
this.nameGiven = nameGiven;
}
...
0
votes
2
answers
34
views
Spring framework dependency injection
I have my controller class and a instance member is annotated with @Autowired annotation. The IndexImplementer call to method2() is successfully executed when the post request is made during testing. ...
0
votes
0
answers
36
views
How can i use a contructor as parameter to another constructor in c++
An exercise am working on, I created two classes, Book & Date. The Date constructor simply takes 3 int arguments for day, month and year. The Book constructor takes string isbn, string title, ...
0
votes
1
answer
69
views
Pass the field parameter of the current class in the constructor of the current class to the constructor of the parent class
Is it possible to pass the ‘this.lst’ field in the Test1 class constructor to the Test class constructor (without making the ‘lst’ field static)?
class Test
{
internal Test(List<int> lst)
...
0
votes
0
answers
24
views
"x" is not a constructor- PlayWright automating testing beginner
I am learning Playwright. This is what I have so far. Can someone please point out what I am doing wrong? I referred to youtube videos and still unable to see what the mistake is. I appreciate your ...