看看错在哪
#include<iostream>using namespace std;
class toy{
public:
toy(int p,int q):price(p),quan(q)
void sum(int p,int q)
{sum=price*quan;}
private:
int price;
int quan;
};
int main()
{toy A[4]={toy(12,10),toy(12,39),toy(33,20),toy(43,20)};
int i;
for(i=0;i<4;i++)
cout<<A.sum()<<endl;
return 0;}