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

explicit c++ keyword: what is wrong with this code?

#include using namespace std; class A { int x; public: class B { public: int y; B(int _y) : y(_y) {} explicit operator A() const { return A(y); } }; explicit A (int _x)…
0
votes
1 answer

Implementing n interface explicitly using Visual Studio

I came across this problem when i was implementing n interface explicitly using Visual Studio. So the interface contains properties, but when I am implementing the property explicitly in an abstract class, Compiler throws error "The modifier…
Rahul
  • 45
  • 6
0
votes
3 answers

Explicit wait return strange findElement value

I'm trying to create a explicit wait method in my framework to handle the user's input. The method is supposed to handle all types of search: id, xpath, and css. However, When I tried testing this method, the error is returning an odd error Method…
MikeyC
  • 85
  • 1
  • 7
0
votes
0 answers

Timed out exception when I try to logout

I have to login yahoomail and then I have to compose mail and then i have to logout. Am able to login ,compose but am unable to logout. Please find below the code for the same. I need to do it through explicit wait. WebDriverWait wait = new…
Wait
  • 1
  • 3
0
votes
0 answers

Explicit and implicit in Python

On the grounds that, according to the famous "Zen of Python" document, "explicit is better than implicit", to the point that we have to declare "self" as a parameter in each and every method, why does Python use type inference? Isn't it more in line…
A. N. Other
  • 409
  • 4
  • 14
0
votes
1 answer

Explicit keyword, move constructor and copy constructor, and disabling move and copy constructor

I understand what explicit keyword does to a constructor with a single parameter, it can surely limit the possibility of unwanted behaviour. I also understand what move and copy constructors do. What I don't understand is, how explicit constructor…
0
votes
1 answer

Overload Resolution: What is the role of explicit and the initialization syntax?

Suppose I have an immutable String class as follows: #include #include class String { public: explicit String(const char *Value) : Size(std::strlen(Value)), Value(new char[Size + 1]) { std::memcpy(this->Value,…
Anirban Sarkar
  • 796
  • 6
  • 14
0
votes
0 answers

Why the "in-place constructors" for std::optional are explicit?

The C++17 standard says that the std::in_place constructors of std::optional must be explicit (the same was with boost::optional). But why?? What is the reason behind this? It forbids to have a nice code like this: struct Value { Value(int) {…
Vahagn
  • 4,670
  • 9
  • 43
  • 72
0
votes
2 answers

Special operators in explicit constructor c++

I'm new to c++ and i'm practicing myself on classes and objects. I've made a program which includes operator overloading and it has an "explicit constructor". I've tried it with a lots of different values and it's working properly, but my explicit…
specbk
  • 99
  • 2
  • 13
0
votes
7 answers

Problem understanding explicit constructor in C++

After reading this thread What does the explicit keyword mean in C++? I made up this program class MyClass { public: explicit MyClass(int a) { cout<<"Int was called"<
Sashi
  • 3,069
  • 6
  • 20
  • 18
0
votes
0 answers

Can I reuse explicit wait from base class with Selenium WebDriver and PHPUnit?

Is there a way to reuse explicit wait from base class? My Base Class scenario: public class BaseClassTest extends PHPUnit_Framework_TestCase { public function baseClassTest() { $driverWait = new WebDriverWait($this->webDriver, 80); …
Pree
  • 11
  • 1
  • 3
0
votes
1 answer

Implicit super constructor. Must explicitly invoke another constructor

I'm just getting into inheritance in my classes, and this is the first error I've had with it. Most of the code is working except for the constructor which throws the title in the errors section. public class CellDoor extends CellPassage { //…
Kevin
  • 47
  • 5
0
votes
1 answer

How does explicit casting work in C?

Let's say I have the following code lines: int a; // 4-byte-integer char b, c, d, e; b = (char)(a >> 24); c = (char)(a >> 16); d = (char)(a >> 8); e = (char)a; Let's also assume that the system is storing the bytes in little-endian mode and a =…
Polb
  • 640
  • 2
  • 8
  • 21
0
votes
1 answer

How to do default property explicit interface in vb.net?

I have been trying to figure out how to do object IList.this[int index] { get { } set { } } public T this[int index] { get { } set { } } In VB.net, and I have not been able to find anything on google. Just to clarify, I am trying…
0
votes
1 answer

Should I still use the keyword explicit for copy constructors?

C++ provides the keyword explicit to suppress implicit conversions via conversion constructors when such conversions should not be allowed. A constructor that's declared explicit cannot be used in an implicit conversion. Use the explicit…
Eduardo
  • 697
  • 8
  • 26