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

54 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+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers