C++
Will the f ...
Site Language: English
Українська
English
Русский
Programming Tests
Login
Sign Up
Programming Tests
Theory
Snippets
Papers
Landing
Android
Prices
FAQ
Cosmo Story
Terms and Conditions
Privacy Policy
Cookies Policy
Send Feedback
Will the following code compile?
namespace { void Foo() { } }
Yes, it will
No, it won't
Explanation
Yes, it will. The Foo() function is defined in an unnamed namespace
functions
namespace
scope
Like
Login in
to like
Comment
Login in
to comment
Share
Tweet
Related Content
Скомпилируется ли следующий код: int a = 0; double b = 0.0; namespace space1 { int a=1; double b=1.0; } namespace space2 { int a=2; double b=2.0; } int main() { int a=0; double b=0.0; return 0; }
В каких строках кода содержатся ошибки: namespace X { int x = 5; namespace Y { int x = 2; void f() { for (int i = 1; i < 10; ++i) { int y = x; ::x += X::x * x; } } } }
В каких строчках содержатся ошибки? struct A { virtual void Foo(int) {} virtual void Foo(int, int) {} void Foo(int, int, int) {} }; struct B : A { virtual void Foo(int) {} }; int main() { B b; b.Foo(1); // 1 b.Foo(1, 2); // 2 b.Foo(1, 2, 3); // 3 }
Что напечатает следующий код: #include <iostream> using namespace std; namespace NA { struct A { A() : a(1) {} int a; }; void f(A &b) { cout << b.a << endl; } } NA::A a; void f(NA::A &b) { cout << b.a*2 << endl; } int main() { f(a); return 0; }
Какой результат работы программы? #include <iostream> using namespace std; void f(double) { cout<<"f1"<<endl; } void f(const int ) { cout<<"f2"<<endl; } void f( int & ) { cout<<"f3"<<endl; } void main(void) { int n = 1; double b = 2; f(n); f(b); }
C
++
Quiz
Login to learn C++
or
Read more about
C++ Quizzes
Follow CodeGalaxy
Mobile Beta
Send Feedback
Keep exploring
C++ quizzes
int main() { const int* i = int(); // 1 int const* j = int(); //2 int* const k = int(); //3 int* l(); //4 ++i; //5 ++j; //6 ++k; //7 ++*k; //8 ++l; //9 } Откомпилируется ли такой код? Если нет, то в каких строчках будут ошибки компиляции? После стандарта C++14.
#include <iostream> using namespace std; int &test() { static int a = 3; return a; } int main() { ++++++test(); cout << test() << endl; return 0; } Что выведет cout?
При истинности какого из приведенных высказываний имеет смысл вычитание указателей?
Какое ключевое слово используется для описания пространства имен?
В чем разница между X x; и X x(); ?
Скомпилируется ли этот код: struct A : int { };
Sign Up Now
or
Subscribe for future quizzes
Login in to like
Login in to comment