// 20结构体与string
//string是一个类,在C++中类与结构体区另不大,因此string类与结构体的区别也不大,既然string类结构体的区别不大,那么我们可以把一个结构传递给函数并返回结构体,我们自然也可以把string对像传递给函数或者返回一个string对像
/*
#include <iostream>
#include <string>
using namespace std;
const string& show(const string &p)
{
     cout<<p<<endl;
	 return p;
}
int main()
{
	string str="hello world";
	string str1 = show(str);
	cout<<str1<<endl;
    return 0;
}*/

  

相关文章:

  • 2021-07-14
  • 2021-05-16
  • 2021-11-02
  • 2021-11-14
  • 2021-06-10
  • 2021-04-06
  • 2021-12-01
  • 2021-04-30
猜你喜欢
  • 2021-06-13
  • 2021-11-08
  • 2021-07-15
  • 2021-10-08
  • 2021-08-12
  • 2021-05-10
  • 2021-06-04
相关资源
相似解决方案