what is 3e in c 2b 2b

Solutions on MaxInterview for what is 3e in c 2b 2b by the best coders in the world

showing results for - "what is 3e in c 2b 2b"
Anna
05 Aug 2017
1/**
2 * @author Charles Salvia (StackOverflow)
3 *
4 * -> is to access a member function or member variable of an object through
5 * a pointer, as opposed to a regular variable or reference.
6 */
7
8// For example: with a regular variable or reference, you use the . operator
9// to access member functions or member variables.  
10std::string s = "abc";
11std::cout << s.length() << std::endl;
12
13//But if you're working with a pointer, you need to use the -> operator:
14std::string* s = new std::string("abc");
15std::cout << s->length() << std::endl;