??????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??????????洢????