C++????????????????????
???????????? ???????[ 2016/12/5 15:13:39 ] ??????????????????? C++
??????????????????????壩????????????????????????????????????????в???С??????????壨?????????壩??????public?????????????private????
????????????????????????????public??????????′?????????????г??????
???????
?????? ????????????????????????????????
?????? δ?????????????????????????????????
?????? ?????????????????????????????????public??
?????? ?????????????????????в????д?κι?????
struct S { //class S Ч?????
int x;
unsigned short y;
};
S testS1={100??123};
S testS2={200};//δ????????????????????????????os2.y=0;
S TestS[4]={ {100??10}??
{200??20}??
{300} };//δ?????????????????os[2].y??os[3].x??os[3].y??
??????????????????private??protected????????????????????????ù??????????г??????
struct S { //class S?????????飬??????
private:
int x;
public:
double y;
S(void){}
S(int idemo??double ddemo) {x=idemo;y=ddemo;}
void show(void) {cout<<x<<''/t''<<y<<endl;}
};
S os1;//??????????????(??ι?????)
S os2(1000??2.345);
S os3=S(2000??4.567);
S os[4]={S(10??1.234)??S(20??2.234)};//δ???????????????????????????????????????????
??????????:
?????? ??S os3=S(2000??4.567);????У????????????????os3?????????????S(int??double)????????os3???г??????
?????? S os3(2000??4.567); ????? S os3=S(2000??4.567);
?????? ?????os3??????????S os3(100??1.234);os3=S(2000??4.567)?????????????????????os3????????operator=?????????????????????????????????=??????????????????????????????????е????????С?
??????????????????????????????????????????????
??????????????£?
#include <iostream>
using namespace std;
class C {
private:
int x;
public:
C(int idemo) {x=idemo;}
void show(void) {cout<<x<<endl;}
};
struct S {
private:
int x;
public:
S(int idemo) {x=idemo;}
void show(void) {cout<<x<<endl;}
};
int main(int argc?? char *argv[]){
C oc=1000;//??????????????
oc.show();
S os=2000;//??????????????
os.show();
return EXIT_SUCCESS;
}
??????
???·???
??????????????????
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