Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8003083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:33:41+00:00 2026-06-04T16:33:41+00:00

I’ve been working on this for a while now and I can’t seem to

  • 0

I’ve been working on this for a while now and I can’t seem to figure it out. I cannot compile the code as it keeps throwing the below error. Basically what Im trying to do is create a vector which contains objects from both a base and derived class using pointers.

Final Assignment.obj : error LNK2019: unresolved external symbol “public: __thiscall Product::Product(void)” (??0Product@@QAE@XZ) referenced in function “public: __thiscall SaleProduct::SaleProduct(char,class std::basic_string,class std::allocator >,int,double,double)” (??0SaleProduct@@QAE@DV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@HNN@Z)
fatal error LNK1120: 1 unresolved externals

#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <iomanip>
#include <vector>
#include <string>
using namespace std;

class Product
{


public:

Product();
Product(char iT,string des,int inv,double p,double dis)
{
invType = iT;
description = des;
inventory = inv;
price = p;
discount = dis;
}

char getInvType(){
return invType;
}

protected:
char invType ;
string description;
int inventory;
double price;
double discount;
};

class SaleProduct:public Product {

public:



//SaleProduct();
SaleProduct(char iT,string des,int inv,double p,double dis){


}


};



int main()
{
int choice = 0;
// SaleProduct* SaleProductOB;
// Product *productPoint = &ProductOB;
 vector<Product*> inventoryVec;

  char invType;
  string description;
  int inventory;
  double price;
  double discount = 0;




ifstream inFile("Inventory.txt");

if (inFile.is_open()){

while (inFile >> invType >> description >> inventory >> price >>discount){

      if (invType == 'S'){

           inventoryVec.push_back(new SaleProduct(invType,description,inventory,price,discount)  );
     }else{
    //inventoryVec.push_back(new Product(invType,description,inventory,price,discount)  );

      }

}
}else{
cout << "File is not ready!";
}



cout << inventoryVec.size() << endl;


while (choice != 3) {
        cout << "Please enter your choice:" << endl;
        cout << "1. Print available items"  << endl;
        cout << "2. Add item to cart"       << endl;
        cout << "3. Print receipt and quit" << endl << endl;

        cin >> choice;
 }








//system("PAUSE");
return 0;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T16:33:43+00:00Added an answer on June 4, 2026 at 4:33 pm

    You may need to specify the correct constructor (as is, it is trying to use the default constructor, which has no actual definition):

    SaleProduct(char iT,string des,int inv,double p,double dis) : 
       Product(iT, des, inv, p, dis ){
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
Does anyone know how can I replace this 2 symbol below from the string
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.