lasd/teoria/domande.cpp

18 lines
470 B
C++
Raw Normal View History

2021-03-18 21:54:45 +01:00
#include<iostream>
using namespace std;
int main(){
string s1 = "hello";
string s2 = "world";
cout<<"Stringa 1: "<<s1<<endl<<"Stringa 2: "<<s2<<endl;
cout<<"PTR Stringa 1: "<<&s1<<endl<<"PTR Stringa 2: "<<&s2<<endl<<endl;
s1 = move(s2);
cout<<"Stringa 1: "<<s1<<endl<<"Stringa 2: "<<s2<<endl;
cout<<"PTR Stringa 1: "<<&s1<<endl<<"PTR Stringa 2: "<<&s2<<endl<<endl;
s2 = "cacca";
cout<<"Stringa 1: "<<s1<<endl<<"Stringa 2: "<<s2<<endl;
return 0;
}