1. Trang chủ
  2. » Thể loại khác

IT Ebooks - Trang Minh Truc's website C++ Templ

2 65 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 2
Dung lượng 1,82 MB

Nội dung

C++ Templates - TEST Which of the following is illegal: A template func(T x) {} template func(T* x) {} B template class myObject {}; C template class myObj { template memFunc() {} }; What problems can a templated member function cause? A They're just not legal B They're hard to use C They allow violations of encapsulation When must template functions have explicit template parameters? A Always B When the template types cannot be inferred C Never, the template types can always be inferred When are templates usually instantiated? A At runtime B At compile time C At link time Are templates conceptually related to polymorphism? A Nope B Only when the template types are objects C Yes, but compile-time polymorphism In general, is it possible to completely hide the source code of a library written using templates? A Yes, but using export feature B No, pretty much never C Yes, all the time Which of the following describes a potentially surprising result of using templates? A Slower programs B Poor variable naming in the debugger C Increased executable size in comparison to the code base Which of the following is an invalid template declaration: A template int func() {return x;} B template double func() {return x;} C template void func(x t) {} What is the result of trying to run this program: #include template struct X { enum val {v = T * X::v }; }; template struct X { enum val {v = }; }; int main() { std::cout

Ngày đăng: 09/12/2017, 12:03

TỪ KHÓA LIÊN QUAN

w