These questions are a kind of game, and I did not find the solution for them.
It is possible to write :::
in C++ without using quotes or anything like this and the compiler will accept it (macros are prohibited too).
And the same is true for C# too, but in C#, you have to write ???
.
I think C++ will use the ::
scope operator and C# will use ? :
, but I do not know the answers to them.
Any idea?
You can write three consecutive question marks in C# without quotes, but not without whitespace, using the null-coalescing operator and the nullable alias character:
object x = 0;
int y = x as int? ?? 1;
With whitespace, it's easy:
C++
class A{};
class B : :: A{};
or
int foo;
int bar(){
return decision ? -1 : :: foo;
}
But without whitespace, these won't compile (the compiler sees :: :
, which doesn't make any sense).
Similarly, Aaronaught gave a good example of ? ??
in C#, but without whitespace, the compiler sees it as ?? ?
, which won't compile.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With