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
class
:
Content language: Русский
English
Отметьте верные утверждения:
class
Могут ли динамические библиотеки экспортировать шаблонные функции и классы:
class
Что выведет на экран данный код? #include <iostream> template <class T> struct A { typedef typename T::C TC; A(){ TC::out(); } }; struct B: A<B> { struct C { void out(){ std::cout<<"C";} }; }; int main() { B b; return 0; }
class
Скомпилируется ли код? template<typename T> class A{ A(){} }; // 1 template<typename T> struct B{ B(){} }; // 2 template<typename T> union C{ C(){} }; // 3 template<template<typename> class U, typename V> struct D { D() { U<V> u; } }; int main() { D<A, int> a; // 4 D<B, int> b; // 5 D<C, int> c; // 6 }
class
Выберите допустимые объявления друзей для шаблона // 1 template <typename T> class C { friend class T; }; // 2 template <class T> class C { friend T; }; // 3 template <typename T> class C { typedef T type; friend class type; };
class
Какой тип будет иметь s2<int>::type, если s2 определена следующим образом: tеmplаtе<сlаss T> struсt s { tуpеdеf T* tуpе; }; tеmplаtе<сlаss T> struсt s<T&> { typеdеf соnst T* tуpе; }; tеmрlаtе<сlаss T> struсt s2 : s<T*> { };
class
Скомпилируется ли код? class Foo { protected: int a; }; template<class T> class Getter : public T { public: int Get(int v) {return a;} }; template<class T> class Setter : public T { public: void Set(int v) {a = v;} }; template<class T> void f1(Setter< T > f) {}; template<class T> void f2(Getter< T > f) {}; int main(int argc, char* argv[]) { Getter< Foo > a; Setter< Foo > b; Setter< Getter< Foo > > c; f1(a); // 1 f2(a); // 2 f1(b); // 3 f2(b); // 4 f1(c); // 5 f2(c); // 6 return 0; }
class
Какие из объявлений шаблонов верны?
class
Что будет в результате выполнения кода? #include <iostream> using namespace std; template<class T> struct Bar { T data; Bar(){ cout << "Default construct"<<endl; } template<class X> Bar(const Bar<X>& val) { data = val.data; cout << "Template copy construct"; } }; int main(){ Bar<int> b1; Bar<int> b2(b1); Bar<double> b3(b1); cin.get(); return 0; }
class
Какой из вариантов кода не содержит ошибки?
class
← Prev
11
12
13
14
15
Next →
Sign Up Now
or
Subscribe for future quizzes