Beispiel #1
0
 // Copy Constructor
 Good::Good(const Good& other) {
   upc(other._upc);
   name(other._name);
   price(other._price);
   qtyNeeded(other._qtyNeeded);
   taxed(other._taxed);
   quantity(other._quantity);
 }
Beispiel #2
0
 Good::Good(const char* u, const char* n, double p, int q, bool t) {
   upc(u);
   name(n);
   price(p);
   qtyNeeded(q);
   taxed(t);
   quantity(0);
 }
Beispiel #3
0
  // operator=
   Item& Item::operator=(const Item& RO){
      upc(RO._upc);
      name(RO._name);
      price(RO._price);
      quantity(RO._quantity);
      taxed(RO._taxed);
      qtyNeeded(RO._qtyNeeded);

      return *this;
   }
Beispiel #4
0
		Product::Product(const char* s, const char* n, double x, int i, bool tax) {
				//	Copies the SKU into the corresponding member variable up to MAX_SKU_LEN characters. 
				//still hae to implement  as just does (strcpy(x,y)) right now
				sku(s);
				name(n);
				price(x);
				qtyNeeded(i);
				quantity(0);
				taxed(tax);
		}
Beispiel #5
0
 // Assignment Operator=
 Good& Good::operator=(const Good& other) {
   if (this != &other) {
     upc(other._upc);
     name(other._name);
     price(other._price);
     qtyNeeded(other._qtyNeeded);
     taxed(other._taxed);
     quantity(other._quantity);
   }
   return *this;
 }
Beispiel #6
0
		//copy con
		Product::Product(const Product& other) {
				//
				sku(other.sku_);
				name(other.name_);
				price(other.price_);
				taxed(other.taxed_);
				quantity(other.quantity_);
				qtyNeeded(other.qtyNeeded_);
				

		}
Beispiel #7
0
		Product& Product::operator=(const Product& other) {
				//may not need to test this
				if (this != &other) {
						sku(other.sku_);
						name(other.name_);
						price(other.price_);
						taxed(other.taxed_);
						quantity(other.quantity_);
						qtyNeeded(other.qtyNeeded_);
				}
						return *this;
				
		}
Beispiel #8
0
    //==================================================
    // copyFromSource
    //
    // This function deeps copy data from the source into this object. Can be used for copy constructor and
    // assignment operators
    //==================================================
    Good& Good::copyFromSource (const Good& source) {
        char tmpUpc  [MAX_UPC_LEN + 1];
        char tmpName [2000];

        strncpy (tmpUpc,  source.upc  (), MAX_UPC_LEN);
        strncpy (tmpName, source.name (), 2000);

        upc       (tmpUpc);
        name      (tmpName);
        price     (source.price     ());
        quantity  (source.quantity  ());
        taxed     (source.taxed     ());
        qtyNeeded (source.qtyNeeded ());

        return *this;
    }