C ++ and study notes Lesson Ten new malloc, namespaces

Study Notes content from: Ditai Software College Tangzuo Lin teacher's video, I appreciate your guidance

The difference between the new keyword and malloc function:

1.new keywords are part of the C ++
2.malloc C library function is provided
3.new to the particular type of memory allocation units of
4.malloc bytes for memory allocation
5.new type in a single application It can be initialized when the variable
characteristic does not have memory initialization 6.malloc
7. Accordingly, the destructor will delete trigger object class, free not

C ++ namespaces:

1. Only a global scope in C language, all global identifiers share the same scope, possible conflicts between identifiers
2. The concept of namespaces in C ++ namespace global scope will be divided into different portion, a namespace identifier may be of the same name does not conflict with each other can be nested namespaces
3. global scope also called default namespace
4. when a plurality of files with the same name the general definition namespace, if the content of different , then added, if the content is the same, the link error

Instructions:

1. entire namespace: namespace name the using;
2. Use namespace variables: the using variable name ::;
3. the default namespace variables ::: variable

Published 14 original articles · won praise 0 · Views 100

Guess you like

Origin blog.csdn.net/u012321968/article/details/104450271