Learncado
Learncado

Learncado brings together a vast collection of questions and answers. Expand your knowledge, learn new skills, and find solutions to your queries effortlessly. Enhance your learning experience and save valuable time by exploring our website today.

Resources

  • Questions
  • Question By Tags

Help and support

  • Contact
  • About

  • Geniecourse
  • Jetsodeals
  • Rentcado
  • Dealcado
© 2021-2023 Learncado All Rights Reserved.

Search Results (177)

Results for constructor

November 29th, 2023
Why can't clang++ find a matching basic_string constructor?

When compiling my tests in CI on macOS 11, I get an error: no matching constructor for initialization of 'std::string' (aka 'basic_string') for this...

c++
Read more
November 28th, 2023
Pass by reference to base class constructor from derived class constructor

I would like to include a reference of a struct, Coord, within a class, Base, from the initializer list of derived class, Derived. When I pass the ins...

c++pass-by-reference
Read more
November 28th, 2023
Scheduling callback with virtual function in constructor

As Scott Meyers wisely taught us in Effective C++ (3rd ed.): Item 9: Never call virtual functions during construction or destruction. Now, consider ...

c++inheritancelambda
Read more
November 29th, 2023
Autofac - dynamic instantiation: passing constructor manually

I use dynamic instantiation in AutoFac: public class X: I_X { public X(String p1, String p2) { ... } } public cl...

c#autofac.net-4.8instantiation
Read more
November 27th, 2023
Null checking with primary constructor in C# 12

I using C# 12. In C# 12 I can use primary constructor: public class UserService(IUnitOfWork uow) : IUserService { } Before C# 12 I used null checking...

c#.net-8.0c#-12.0primary-constructorfail-fast
Read more
November 27th, 2023
Why I can't use 'super' in prototype method definition when I can use Object.getPrototypeOf(this.constructor.prototype)?

So I tested this code: class C1 {} C1.prototype. f =function(){ return 1 } class C2 extends C1 {} C2.prototype. f =function(){ return super.f()+1 }...

javascriptprototypal-inheritancees6-classjavascript-inheritance
Read more
November 22nd, 2023
C# Generic constructor parameter from inherited class

I'm searching for a solution that I have a generic constructor parameter where the T is the type of the derived class: public abstract BaseClass{ /...

c#
Read more
November 21st, 2023
How to pass big data from a factory to a constructor with neither dynamic memory nor unnecessary copies?

Runge-Kutta schemes consist of an algorithm, implemented in Scheme, and a piece of data, called Table (Butcher tableau). For the construction of a sch...

c++stack-memorystdmoveelision
Read more
November 19th, 2023
Is the constructor of a temporary object guaranteed to happen before any arguments to a member function called on it are evaluated?

If I have a macro like #define ABORT(msg) AbortHelper(__FILE__, __LINE__).Report(msg) Is AbortHelper::AbortHelper(const char*, long) guaranteed to be ...

c++
Read more
November 21st, 2023
Unit testing a controller with parameterized constructor in xunit project using MOQ

I am trying to write a xunit test method for my controller to test a JsonResult. But since the controller takes a parameter which will be injected fro...

c#asp.net-core-6.0xunit.net
Read more
November 17th, 2023
Initializing properties in the primary constructor of a Kotlin data class

I'm working on a Kotlin project that needs to work with 'rational' numbers. To do that I have a class that stores a rational number as two integers (n...

constructorkotlinclassinitialization
Read more
November 12th, 2023
Can you implicitly activate array member of union in a C++20 constexpr constructor?

I'm using C++20 and have a structure that contains a transparent union that contains an array. I need my structure to have a constexpr constructor, b...

c++constexprc++20unions
Read more
November 13th, 2023
ProductService is not initialized in the constructor in Controller

I have a simple ProductController which uses ProductService to retrieve a product given the productId. However, when the productService is initialized...

node.jsexpress
Read more
November 10th, 2023
Simple Situation! Weird Result! Spring prototype bean don't work, and every time I call getter or setter, the constructor was called

I am learning Spring and using XML-way to create 2 beans instances of a POJO Class named "Notepad". finally I got two instances: n1 = Notepad@56dc1551...

springdependency-injection
Read more
November 5th, 2023
How to extend function constructor with class

Is there any easy way to inherit function constructor from class? For example I have this code: class Parent { constructor() { this.parentFi...

javascriptclassoop
Read more
November 3rd, 2023
Why tbb::enumerable_thread_specific does not accept types with not-const references in constructor arguments?

I would like to create thread local storage using tbb::enumerable_thread_specific for elements of type that takes not-const reference in the construct...

c++multithreadingtbb
Read more
November 3rd, 2023
How to lazy init class member without a default constructor

How do I lazy init class members without a default constructor? Here is the minimum reproducible example: #include #include #include using namespac...

c++member-initializationdatamember
Read more
November 2nd, 2023
Does a C++17/20 compiler optimize returning a local varaible by copy elision or invoking move constructor?

Say we have a class: class Foo { public: Foo() = default; Foo(const Foo&) = default; Foo(Foo&&) = default; // other functions... private: //...

c++c++17c++20copy-elision
Read more
October 30th, 2023
Why is there no instance of the constructor?

I am new to wxWidgets, and am trying to pass in a pointer to my parent window using the this keyword. Here is the code. The code for the frames header...

c++pointerswxwidgets
Read more
October 29th, 2023
Parameter x of constructor in ... required a bean of type '...' that could not be found

I am working on a personal project with Spring Boot. I am getting the following error: Parameter 2 of constructor in com.learningapp.backend.Academix...

javaspringwebmapstructhttpbackend
Read more
October 31st, 2023
Unwanted copy constructor call when creating a shared_ptr

While doing some coding practice, I encountered the following error when attempting to pass ownership of an optional std::unique_ptr to a std::shared_...

c++c++17shared-ptrunique-ptr
Read more
October 22nd, 2023
c# child constructor calls parent constructor depending on a value

This is my problem, I have it sorted, but I think that there is a better way of doing this: I have the following code: public class A { public A(i...

c#constructorinheritance
Read more
October 21st, 2023
How to create an instance of subclass from a factory (i.e., constructor) which invokes the super __init__ directly?

I have an abstract class A, and a concrete subclass B. B has a constructor with a large code base depending on it but now I need a new way to construc...

python
Read more
October 20th, 2023
virtual multiple inheritance constructor

I'm working on a C++ code example that uses virtual inheritance and multiple inheritance. In my code, I've noticed that I have to call the constructor...

c++virtual-inheritance
Read more
October 19th, 2023
Copy constructor is not called in the for_each loop

Trying to learn C++ and I was practicing for_each loop and lambdas. I am writing a simple example where a members of a vector are constructed in the f...

c++
Read more

Hot Topic

  • 25881

    How do I undo the most recent local commits in Git?

  • 11618

    How can I remove a specific item from an array in JavaScript?

  • 20343

    How do I delete a Git branch locally and remotely?

  • 7387

    How can I find all files containing a specific text (string) on Linux?

  • 7330

    How to find all files containing specific text (string) on Linux?

  • 7611

    How do I revert a Git repository to a previous commit?

  • 2671

    How do I create an HTML button that acts like a link?

  • 8481

    How do I check out a remote Git branch?