EECE 2160 Lecture Notes - Lecture 3: Concatenation, Type Constructor, Scanf Format String

56 views8 pages

Document Summary

The purpose of a namespace is avoiding name conflicts in public identifiers across different files. If two functions with the same name are declared in different namespaces, they will not interfere with each other. In order to reference variables within namespaces, it would look like hello::varname. Using namespace name will allow you to use all variables in that particular namespace without having to reference it with the above notation. Using namespace std is the variables in the standard library. Built into std::string library int main() std::string first = john ; std::string last = smith ; std::string full = first + + last; (string concatenation) C++ uses built in operators new and delete as a replacement for functions malloc and. Free int main() int *x; double *v; x = new int; *x = 10; v = new double[10]; allocates 80 bytes of memory v[5] = 2. 2; delete x; delete[] v; An object is a variable of a class type.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers