Quizzes
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
static_cast
:
Content language: Русский
English
Что будет выведено в результате работы программы? #include <iostream> using namespace std; int main(int argc, char * argv[]) { signed char a = -128; a = -a; cout << static_cast< int >(a) << endl; }
static_cast
static_cast
Какой будет вывод следующей программы? #include <iostream> class A { public: A(int n = 0) : m_n(n) { std::cout << 'd'; } A(const A& a) : m_n(a.m_n) { std::cout << 'c'; } private: int m_n; }; void f(const A &a1, const A &a2 = A()) { } int main() { A a(2), b; const A c(a), &d = c, e = b; b = d; A *p = new A(c), *q = &a; static_cast<void>(q); delete p; f(3); std::cout << std::endl; return 0; }
static_cast
← Prev
1
2
Next →
Sign Up Now
or
Subscribe for future quizzes