当我们定义复制或移动构造函数时,我们可以访问另一个类的私有变量。C ++是否会friend自动使它们彼此交互?
例如:
my_str::my_str(my_str&& m)
{
size_ = m.size_; //accessing private variable another my_str class
buff_ = m.buff_; //accessing private variable another my_str class
m.buff_ = nullptr;
m.size_ = 0;
}
Run Code Online (Sandbox Code Playgroud) 我创建了一个示例项目(我的操作系统:Windows 10);
expo init test
cd test
npm start
Run Code Online (Sandbox Code Playgroud)
一切运作良好,我可以在手机上看到我的应用程序和我的package.json看起来;
{
"name": "empty-project-template",
"main": "node_modules/expo/AppEntry.js",
"private": true,
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"eject": "expo eject"
},
"dependencies": {
"expo": "^30.0.1",
"react": "16.3.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-30.0.0.tar.gz",
}
}
Run Code Online (Sandbox Code Playgroud)
但是,如果我想安装像"uuid"这样的软件包;
npm install uuid
Run Code Online (Sandbox Code Playgroud)
包安装没有问题,然后我写;
npm start
This command requires Expo CLI.
Do you want to install it globally [Y/n]?
Run Code Online (Sandbox Code Playgroud)
我按'Y',但它给出了错误;
This command requires Expo CLI.
Do you want to install it globally [Y/n]? y
Installing …Run Code Online (Sandbox Code Playgroud)