C++????????????????
???????????? ???????[ 2014/2/12 9:25:01 ] ???????????????? C++ ???? object
??????C++???????????????????
???????????
????ClassName object(param);
?????????????????ClassName?????object????C++?????????????????????г????洢???
????????????洢???C++?????????????????????????????????????ж?????????????????洢????е?????????????????????ж??????
???????磬??????????????????
class Rec
{
public:
Rec(int width??int height);
~Rec();
int getArea();
private:
int Rwidth;
int Rheight;
};
????????Rec myRec(5??5);???????????myRec???????????sizeof(myRec);????????? 8 ????????
???????myRec????2??int????????????????int????4??????????myRec?????8??????
?????????????????????????????????е????C++???????????????????ù???????????????
????????÷????????????????????????????“.”??????????“->”.??myRec.getArea();
????=============================================================================================
????????????
ClassName *object=new ClassName(param);
delete object;
?????????????java?е??????????????????????????????????????????????????????????????C++??new??????????????????????????object??????ClassName?????C++?????object????????????????????????new ?????????????????delete??????????????delete?????????????????????
???????new?????????????“*”??“.”???????????????????????????????“->”;
???????磺Rec *rec=new Rec(3??4);
????rec->getArea();
????delete rec;
???????????£?
????????????????????????????????????洢??????????????洢???????????????????????????洢???ú????????????????????洢???????????????c???????malloc??free???????????洢?????c++?????new??delete??????????洢????
??????
???·???
??????????????????
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