C++??????????
???????????? ???????[ 2012/11/20 9:56:46 ] ????????
????4???±??????
????С?????????????????????????????????????????????????????????????????????????á?
????С?漲???????China???????????????λ????????hina.h?????У?
#if !defined(AFX_HINA_H__2E76F1BB_EE30_4584_9C8F_C46A4C613620__INCLUDED_)
#define AFX_HINA_H__2E76F1BB_EE30_4584_9C8F_C46A4C613620__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif
#include <string>
class China
{
public:
China();
std::string& operator[](const int index);
virtual ~China();
private:
std::string *province;
};
#endif
?????????hina.cpp??????????
#include "hina.h"
China::China()
{
province=new std::string[34];
province[0]=std::string("????");
province[1]=std::string("?????");
province[2]=std::string("??????");
}
China::~China()
{
delete []province;
}
std::string& China::operator [](const int index)
{
if(index<0||index>34)
return std::string("?д???");
return province[index];
}
????????????±???????????????????????????????main?????в????????
#include <iostream>
#include "hina.h"
using namespace std;
int main()
{
China c;
c[0]="?????";
cout<<c[0]<<endl;
return 0;
}
????????????????????????????c?????е????c[0]="?????";?У?c[0]???????cout<<c[0]<<endl;??c[0]?????????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11