***
2310 ワード
, 。 c++ 。 。
: , , 。 , 。
。 。 , (ADT)。 ADT : 。 , , 。 , 。 , 。
, 。 , “::”, , , 。
:
//クラス定義struct SalesDate{//データメンバー説明string productNo;double price=0.0;unsigned unitSold=0;//メンバー関数説明double totalRevenue();void read();void print();}//クラス定義終了//メンバー関数のクラス外定義double SalesDate::totalRevenue(){return price*unitSold;}void SaleDate::print(){ cout< }
, : , , 。
, 。 , 。
, 。
c++ , 。 :public,pricate,protected
structクラス名{public:共有メンバー宣言;private:プライベートメンバー宣言;protected:保護されたメンバー宣言;};
public 。
private 。
protected , 。
, , 。 , , 。 , 。 。 。 。c++ class 。
class SaleDate{public://クラスのインタフェースdouble totalRevence();void read();void print();private://プライベートデータstd::string productNo;double price=0.0;unsigend unitSold=0;};
, , this 。this , 。
this :
1,
2,
3,
。 : 。
c++ , , , 。 , 。
, , 。 , 。
。
。 “~”。 , 。
//口座に構造解析関数class Account(public:...~Account();//構造関数private:...};
const ,const 。 , const 。 const 。
mutable( )。
static, 。static 。
c++ , c++ , , 。 , 。