Question #15: Which of the following functions are found when called in main during name lookup?
2009-05-11 17:06
651 查看
Question #15: Which of the following functions are found when called in main during name lookup? 55% on 10310 times asked #include <iostream> namespace standards { struct datastructure { }; void foo(const datastructure& ds) { } void bar() { } } int main(int argc, char** argv) { standards::datastructure ds; foo(ds); bar(); return 0; } | |
foo - correct | |
bar | |
foo and bar | |
neither | |
description: This is called koenig lookup or argument dependent name lookup. In this case, the namespace 'standards' is searched for a function 'foo' because its argument 'ds' is defined in that namespace. For function 'bar', no additional namespaces are searched and the name is not found. More details are in 3.4.2. |
相关文章推荐
- Question 13: Which of the following declarations of function main are standard or standard conforming extensions? (Please note t
- Question 8: In which of the following scenarios is a Copy Constructor called or invoked?
- Question 6: Which of the following are container adapters in the STL (Standard Template Library) in C++?
- Question 23: Which of the following C++ keywords are designed to speed up execution of a C++ function?
- Question 37: In C++, which of the following statements regarding the code below are valid?
- (NOT CLEAR)Question 45: Which of the following options are returned by the typeid operator in C++?
- whether the results are the same of getClass().getName() called in child class and parent class?
- Question 19: Which of the following are not pre-processor directives in C++?
- Which of the following expression(s) will NOT cause an error when used to replace the ***** in the C
- Question 11: Which of the following statements describe the result when standard new cannot allocate the requested storage in C+
- Question 48: In C++, which of the following statements accurately describe a base class destructor calling a virtual function ov
- /*程序员面试宝典*/Which of the following statements describe the results of executing the code snippet below in C++?
- Which of the following statement(s) equal(s) value 1 in C programming language?
- In which of the following does a C++ developer use the placement new syntax to make new allocate an
- Question 12: In C++, which of the following is the best declaration for an overloaded operator[] to allow read-only access (and
- Question 17: Which of the following identify const-correctness failures in the C++ program below?
- Question 41: Which of the following operators must be overloaded by function objects in the Standard Template Library?
- 异常-----Can't convert the date to string, because it is not known which parts of the date variable are in use. Use ?date, ?time or ?datetime built-in, or ?string.\u003Cformat> or ?string(format) built-
- Question 4: Which of the following statements correctly describe the code below in C++?
- (NOT CLEAR)Question 22: Which of the following functions of the ifstream class can be used to determine the current position of