C++中的string与char[]、char*详解_c++ string char*-CSDN博客 https://blog.csdn.net/m0_37433111/article/details/107347101
#ifndef _Person_H #define _Person_H class person { char* name; int id;
public: void set(char*,int); void getdetails(); }; #endif
#include <iostream> #include "person.h" void person::set(char* c, int i) { name = c; id = i; }; void person::getdetails() { std::cout << person::id << person::name << "ok person" << std::endl; }
person p; char a[] ="abc"; p.set(a,123); p.getdetails();
翻译
搜索
复制
标签:set,string,int,void,char,person From: https://www.cnblogs.com/papering/p/17920052.html