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 9287675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T19:44:03+00:00 2026-06-18T19:44:03+00:00

I need to create two separate linked lists and then compare them. However, when

  • 0

I need to create two separate linked lists and then compare them. However, when I try to create a second list with the same operator overloading for the constructor, I get an error:

“A value of type polynomial2* cannot be used to initialize an entity of the type polynomial*”

Here is my code for that sections:

Header:

#include <iostream>
#include <string>

using namespace std; 

struct polynomial
{ 
    polynomial();
    polynomial(string newCoefficient, string newPower, polynomial *nextPtr);
    string coefficient;
    string power;
    polynomial *next; 
};

struct polynomial2
{ 
    polynomial2();
    polynomial2(string newCoefficient2, string newPower2, polynomial2 *nextPtr2);
    string coefficient2;
    string power2;
    polynomial *next2; 
};

class linkedList
{
public:
    linkedList();
    void callFunctions();
private:
    polynomial *head;
    polynomial2 *head2;
    void makeList(polynomial *head, polynomial2 *head2);
    void showList(polynomial *head);
    void compareNodes(polynomial *head, polynomial2 *head2);
};

#endif
/* defined(__Assignment3__Polynomial__) */

.CPP Code:

linkedList::linkedList()
{
    head = 0; 
};

polynomial::polynomial()
{
    coefficient = " "; 
    power = " "; 
    next = NULL;
};

polynomial2::polynomial2()
{
    coefficient2 = " "; 
    power2 = " "; 
    next2 = NULL
};

polynomial::polynomial(string newCoefficient, string newPower, polynomial *nextPtr )
    :
coefficient(newCoefficient),
    power(newPower), 
    next(nextPtr) 

{}

polynomial2::polynomial2(string newCoefficient2, string newPower2, polynomial2 *nextPtr2)
    :
coefficient2(newCoefficient2),
    power2(newPower2), 
    next2(nextPtr2)

{}

The error appears on the last line of the .cpp file at “next2(nextPtr2)”. “nextPtr2” is underlined

  • 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-18T19:44:04+00:00Added an answer on June 18, 2026 at 7:44 pm

    In your polynomial2 definition, did you mean to put:

    polynomial2 *next2;
    

    instead of

    polynomial *next2;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to create one list based on two other lists. But seems like
I need to create two (or more) WPF windows from the same process. But
I am working on a product page and need to create two separate galleries
So I'm doing this project for my OO class. We need to create two
If I want to do bi-directional mapping, do I need to create two mapping?
I have the following three arrays and need to create a new two-dimensional array
I need to create a class with two properties: LogOutput ExceptionOutput These properties (Actions<>)
I have two objects I need to create a relationship between in Core Data.
I need to create a table that will combine two database tables together. Both
I need to create a new Hash object using two arrays. But, the conditions

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.