Изменения

Перейти к: навигация, поиск

Участник:Yulya3102/Плюсы2сем

1073 байта добавлено, 23:39, 9 марта 2013
перегрузка операторов, ADL
=== виртуальное наследование ===
=== зачем нужны namespace'ы ===
Namespaces allow to group entities like classes, objects and functions under a name. This way the global scope can be divided in "sub-scopes", each one with its own name. === namespace'ы, using declaration, ====== using directive, === using namespace namespace_name;Делает все объекты из namespace_name доступными в текущем scope  namespace a { int v; } namespace b { int v; } И два случая: { using a::v; using namespace b; // ошибки нет } { using a::v; using b::v; // ошибка из-за повторного объявления } === namespace aliases ===We can declare alternate names for existing namespaces according to the following format:  namespace new_name = current_name; 
=== перегрузка операторов, ADL ===
In the C++ programming language, argument-dependent lookup (ADL), or argument-dependent name lookup, applies to the lookup of an unqualified function name depending on the types of the arguments given to the function call.
namespace NS
{
class A {};
void f( A *&, int ) {}
}
int main()
{
NS::A *a;
f( a, 0 ); //calls NS::f
}
 
=== зачем нужны шаблоны ===
=== базовое представление о шаблонах ===
355
правок

Навигация