Questions tagged [explicit]

In C++ specifies constructors and conversion operators that don't allow implicit conversions or copy-initialization. In C# declares a user-defined type conversion operator that must be invoked with a cast. For MS SQL Server for-xml-EXPLICIT mode use the [for-xml-explicit] tag

405 questions
0
votes
1 answer

Use assignment operators instead of an implicit constructor

In my program, I am trying to use the assignment operator= to assign an object of my class. I am specifically trying to call the assignment operator instead of an implicit constructor (thus the explicit keyword). When I try to compile, I get a C2440…
jakob
  • 147
  • 1
  • 7
0
votes
0 answers

Why implicit constructor with one parameter prints the last value, if multiple values are passed during object creation?

I have a class 'Entity'. It has a user-defined constructor (implicit) with one argument as shown below. class Entity { public: Entity(int a) { std::cout << a << std::endl; } Entity(const std::string& s) { …
pkthapa
  • 1,029
  • 1
  • 17
  • 27
0
votes
2 answers

Multiplication Explicit Casting not working C

long long int calculateUnits(int tokenVal, int billVal, int numOfTokens, int numOfBills) { long long int units; // tokenUnits = billVal * numOfTokens; // billUnits = tokenVal * numOfBills; units = (long long int)(billVal *…
EniGzz
  • 7
  • 1
  • 3
0
votes
1 answer

Is there a way for the typescript compiler to throw an error when using the "any" type explicitly?

I am trying to make my code as strict as possible with TS. Is there a way to make the following declaration using "any" as a type to throw an error since it should be a "string" type? const foo: any = "bar"
Ryan Santos
  • 367
  • 4
  • 12
0
votes
0 answers

Explicit Forward-Difference Method in Fortran Programming(Gives Overflow)-(what inputs should be given)

Question Link-(https://drive.google.com/file/d/1A9Vf-e1qbdNZxa_UQ2cy8K4LiEfubU6X/view?usp=sharing) The problem is with inputs when I give the inputs it gives me overflow error Code That is written for solving the problem:- …
Nakib Rahaman
  • 21
  • 1
  • 1
  • 2
0
votes
1 answer

When to cast a variable

Casting in Apex seems like Black Magic to me. I don't get when should we make an explicit cast, and when it can be implicit. Like: Recipe.apxc public virtual class Recipe{ public string nome; protected string instructions; private String…
0
votes
0 answers

Explicit up casting & Implicit up casting

I'm trying to find the difference between Explicit up casting and Implicit up casting but there's not so much posts about them. Somebody help me pls?
0
votes
2 answers

Ocaml - how do I explicitly declare the list mutable type

I tried something like: let lchars : char ref list = ref [];; but don't work...
manuel
  • 15
  • 5
0
votes
1 answer

Correct definition of explicit default constructor with enum and template arguments

I have a base class Method with subclasses. auto harmonic_force = [](const double& q, const double& k){return -k*q;}; enum SplittingAB{ SS,L42 }; class Method { public: ~Method() = default; virtual void evolute(…
Suslik
  • 929
  • 8
  • 28
0
votes
0 answers

AutoMapper Explicit Expansion and Child Properties

We are currently using AutoMapper 5.1.1 and using Explicit Expansion feature. I have a class as a Loan which has property as LoanTypeId-> int and other Property which is of type called Property. In certain cases we want to fetch everything in the…
Punit
  • 1,347
  • 3
  • 20
  • 39
0
votes
1 answer

How can I ensure explicit constructors are called and allow brace initialization?

Consider basic program below. It has typedef int Number, with the intent of allowing future developers to change this to whatever precision makes the most sense at the time (or even, say, use one of CGAL's number types). You can see that a Point is…
wesanyer
  • 982
  • 1
  • 6
  • 27
0
votes
0 answers

Explicitly initialize reference using constructor with multiple arguments

Let's say I have the classes: class Rect { int w, l; Rect(width, length) : w(width), l(length) {} } class Box { Rect &r; int h; Box(int width, int length, int height); } For the sake of argument, I do not offer default values for…
Osama Kawish
  • 312
  • 1
  • 5
  • 15
0
votes
1 answer

implicit super constructor Shape2D() is undefined. in regards to with "include Java.awts.Color"

I am working on a project that is giving this error " implicit super constructor Shape2D is undefined. Must explicity invoke another Constructor" and dont really understand. Here is my Shape Class import java.awt.Color; import…
72iskcraft
  • 49
  • 1
  • 5
0
votes
3 answers

Save checkbox data in SQL Server using MVC

I use MVC and want to save the checkbox data in boolean form in sql server. The error is in the Customer Form Model when I try to use the Razor view for the checkboxes model. The error is: CS0266: Cannot implicitly convert type 'bool?' to 'bool'.…
0
votes
0 answers

Explicit constructor char* vs string literal

So I was updating some code to use explicit and ran into seemingly inconsistent behavior in something like this: explicit Whatever(const wchar_t* const pszVal) This doesn't work with a literal string which has a type of const wchar_t[x], and…