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?
int foo(); char foo();
Yes
No
Explanation
No, because two functions differ only by the type of a return value, but it is not taken into account during the overload resolution.
functions
overloading
1
(1)
Like
Login in
to like
Comment
Login in
to comment
Share
Tweet
Related Content
Какой результат работы программы? #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); }
Какая из перечисленных перегруженных функций будет вызвана в функции main()? int main() { f(3.4); return 0; }
Что будет выведено на экран в результате выполнения следующего кода? #include <iostream> using namespace std; class ABase { public: void f(int i) const { cout << 1;} void f(char ch) const { cout << 2; } }; class BBase { public: void f(double d) const { cout << 3;} }; class ABBase : public ABase, public BBase { public: using ABase::f; using BBase::f; void f(char ch) const { cout << 4; } }; void g(ABBase& ab) { ab.f('c'); ab.f(2.5); ab.f(4); } int main() { ABBase ab; g(ab); }
Что будет выведено на экран в результате выполнения следующего кода? #include <iostream> using namespace std; class ABase { public: void f(int i) const { cout << 1;} void f(char ch) const { cout << 2; } }; class BBase { public: void f(double d) const { cout << 3;} }; class ABBase : public ABase, public BBase { public: void f(char ch) const { cout << 4; } }; void g(ABBase& ab) { ab.f('c'); ab.f(2.5); ab.f(4); } int main() { ABBase ab; g(ab); }
В чем разница между X x; и X x(); ?
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?
При истинности какого из приведенных высказываний имеет смысл вычитание указателей?
Какое ключевое слово используется для описания пространства имен?
Скомпилируется ли этот код: struct A : int { };
Какие из перечисленных фрагментов кода не содержат ошибки?
Sign Up Now
or
Subscribe for future quizzes
Login in to like
Login in to comment