2016-05-18 17 views
0
#include <iostream> 
#include <string> 
#include <fstream> 

using namespace std; 

class Product 
{ 
    string title; 
    string sirName; 
    string isbn; 
    double wholesalePrice; 
public: 
    Product(); 
    Product(string, string, string, double); 
    ~Product() {} 
    void setInfo(string, string, string, double); 
    string getTitle(); 
    string getSurName(); 
    string getIsbn(); 
    double getWholesalePrice(); 

}; 


//Derived Class----------------------------Stock---------------------------- 
class Stock::public Product{ 

    double retailPrice; 
    char bookFormat; 
    int stockLevel; 

    Stock(); 
    ~Stock() {} 
    void setRetail() 
}; 

だから、基本的に私のストッククラス文句を言わない作業を導出している... 変数ダブルretailPrice文句を言わないのいずれかと言ってタイプ名を作業が許可されていません...派生クラス(Stock)でエラーが発生するのはなぜですか?また

答えて

1

あなたは、いくつかの構文エラー

#include <iostream> 
#include <string> 
#include <fstream> 

using namespace std; 

class Product 
{ 
    string title; 
    string sirName; 
    string isbn; 
    double wholesalePrice; 
public: 
    Product(); 
    Product(string, string, string, double); 
    ~Product() {} 
    void setInfo(string, string, string, double); 
    string getTitle(); 
    string getSurName(); 
    string getIsbn(); 
    double getWholesalePrice(); 

}; 


//Derived Class----------------------------Stock---------------------------- 
class Stock:public Product{ // use ':' instead of '::' 

    double retailPrice; 
    char bookFormat; 
    int stockLevel; 

    Stock(); 
    ~Stock() {} 
    void setRetail() {} // add function body or ';' 
}; 
を持っています
+0

愚かな間違い ありがとう! –

関連する問題