HI. I'm new to programming. can someon help me explain this error?
insertOutput:Code://Jeff Chhouk //Package Shipping Project #include <iostream> using namespace std; class Package// declare base class { private: public: Package(char *, char *); //constructor ~Package(); //destructor virtual float calcShipcost()=0; //zero to make abstract virtual void print()=0; protected: char *first, *last; //for first and last name int Numofitems; int overnightd(); int insurance(); }; Package :: Package(char *f, char *l) { first=new char[strlen(f)+1]; strcpy(first, f); last= new char [strlen(l)+1]; strcpy(last, l); } Package::~Package() // using destructor { delete[] first; delete[] last; } void Package:: print() { cout<< first<< " " << last; } class Tshirts : public Package // declaring derived class of tshirts with base class of Package { public: Tshirts();// constructor ~Tshirts(); //destructor virtual float calcShipcost(); }; float Tshirts:: calcShipcost() { if(overnightd==1 && insurance==1 )//zero no and one is yes return (Numofitems*2.75)+10+(.02*(Numofitems*2.75));//for yes on insuranances and yes delivery else if (overnightd==1 && insurance==0) return (Numofitems*2.75)+10; else if (overnightd==0 && insurance==1) return(Numofitems*2.75)+(.02*(Numofitems*2.75)) ; else (overnightd==0 && insurance==0) return(Numofitems*2.75) ; } Void Tshirts:: print() ]{ cout<<"T shirts cost is:"; Package::print(); } int main { Tshirt tees("Joe", "Smith" 2,1,0); tees.print();//T shirts cost is:$15.50 cout<<"$"<<tees.calc Shipcost()<<endl; system("PAUSE");// must be before return 0 return o; }
t.cpp: In member function 'virtual float Tshirts::calcShipcost()':
Line 66: error: invalid use of member (did you forget the '&' ?)
compilation terminated due to -Wfatal-errors.
I bold the error line.



LinkBack URL
About LinkBacks


