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
2 answers

What is the difference between implicit and explicit String declaration in java?

For Example.. String herName = new String("clark"); and String hisName = "michal"; 1) The first piece of code exactly does, it will create new string object in the heap memory with reference . 2) The second line of code , its an string literal…
Z.I.J
  • 1,157
  • 16
  • 36
0
votes
1 answer

Explicit instantiation of class templates is ignored?

I wanted to check that the extern keyword did infact prevent class code being generated in the translation unit: template struct always_false : std::false_type {}; template class A{ static_assert(always_false::value, "If…
AntiElephant
  • 1,227
  • 10
  • 18
0
votes
2 answers

Convert from enum to string and back using explicit operator casting

I want to convert from an enum to a string using explicit operator casting logic. Why am I getting a “User-defined conversion must convert to or from the enclosing type”? It should be possible to do that since the types are sub-types of the…
0
votes
2 answers

Multithread. Explicit locks and conditions

I'm having a hard time understanding multithreading. Unfortunately, this is one of the assignments I need to submit in order to pass the course. It's about a train: -The train waits for the Passenger Thread to send some passengers until the…
0
votes
2 answers

FOR XML EXPLICIT - repeats attributes values

I need to generate an EXCEL Like XML file inserting data from a table in SQL Server. After some research I have the following SQL Server script using the FOR XML EXPLICIT mode: DECLARE @T AS TABLE (col1 VARCHAR(20), col2 VARCHAR(20)); INSERT INTO…
0
votes
1 answer

SoundCloud Android explicit Intent sharing does not work anymore

Since the latest SoundCloud App update on Android, the explicit intent sharing (from other app) does not work anymore. Instead of showing the share page (which is normally called by the intent), it starts to record audio over the microphone, which…
gal
  • 441
  • 1
  • 4
  • 13
0
votes
1 answer

Explicit modifier for constructors taking reference argument

I read that it's a good practice to define single argument constructors explicit in order to avoid implicit conversions. I understand the pitfall of having int value promoted to class object. I wonder if it also applies to the constructors accepting…
tommyk
  • 3,187
  • 7
  • 39
  • 61
0
votes
2 answers

C++ Ambigous call to constructor

I have a class with several constructors and overloaded operators : class Utf8String { public: Utf8String(); explicit Utf8String( const char * sStr ); Utf8String( const char * sStrBeg, const char * sStrEnd ); Utf8String( const char *…
Virus721
  • 8,061
  • 12
  • 67
  • 123
0
votes
1 answer

C# : when should we use explicit instead of implicit operator override?

I've seen MSDN tutorial about implicit and explicit operators. I've made some tests and it works very well. I know the difference between them (syntaxily speaking), but I do not know the best way to use them. My question could have been : "What kind…
SylafrsOne
  • 59
  • 5
0
votes
4 answers

Explicit type conversion

I have read in a book that specifies this : //: C03:SimpleCast.cpp int main() { int b = 200; unsigned long a = (unsigned long int)b; } ///:~ "Casting is powerful, but it can cause headaches because in some situations it forces the compiler to treat…
Happy Mittal
  • 3,667
  • 12
  • 44
  • 60
0
votes
3 answers

Explicitly typing variables causes compiler to think an instance of a builtin type doesn't have a property, which it does

I narrowed the causes of an AS3 compiler error 1119 down to code that looks similar to this: var test_inst:Number = 2.953; trace(test_inst); trace(test_inst.constructor); I get the error "1119: Access of possibly undefined property constructor…
Ponkadoodle
  • 5,777
  • 5
  • 38
  • 62
0
votes
1 answer

Explicit constructor with all default arguments can't be called from another constructor of the same class

Why explicit constructor with all default arguments can't be called from another constructor of the same class? #include #include class A { public: explicit A(int a = 1, int b = 2) : a_(a), b_(b) {} …
Shamdor
  • 3,019
  • 5
  • 22
  • 25
0
votes
2 answers

Perl: Global symbol "%s" requires explicit package name

I'm pretty new to Perl but I assumed I had in mind basics like variables definition and scope... but it seems not. My problem is that I keep on bumping into error: Global symbol "$save_from_date" requires explicit package name at myMover.pl line…
Maxime
  • 25
  • 3
0
votes
1 answer

Explicity pass base type

I have an explicit function that takes a reference to the base type of a class. What is the proper way to pass that in? I am currently doing a static cast: #include using namespace std; struct Base { Base() { cout << "Base…
Cory-G
  • 1,025
  • 14
  • 26