0

my last question: my last post

I fixed the issue in my last post. everything has been fine till just now. there is a new issue.

in the project A, i have coded up an linkedList class template.

#ifndef LINKEDLIST_H_
#define LINKEDLIST_H_


template<class T>
struct Node{
        T value;
        Node* next;
    };


template<class T>
class linkedList
{

private:
    Node<T>* head;
public:

    bool isEmpty() const{ return head == nullptr;}
    Node<T>* getHead() const{return head;}
    bool existVal(T value) const;
    void insertVal(T value);
    void deleteVal(T value){}



    linkedList(){}
    ~linkedList(){}

};

#endif

Anyways, i created another class, which would included

linkedList<unsigned int> num1

as private member variable.

here is the actual code:

#include"linkedList.h"

#ifndef L2_H_
#define L2_H_

class Add2Nums{
public:
    Add2Nums(unsigned int, unsigned int);
    ~Add2Nums(){}


private:
    linkedList<unsigned int> num1;
    linkedList<unsigned int> num2;
    Add2Nums();
};


#endif


#include"L2.h"


Add2Nums::Add2Nums(unsigned int a, unsigned int b){
    while(a!=0){
        num1.insertVal(a%10);
        a/=10;
    }

    while(b!=0){
        num2.insertVal(b%10);
        b/=10;
    }

}

when i build the project, the following issues came up:

enter image description here

Community
  • 1
  • 1

1 Answers1

1

You need to move linkedList implementation to the end of linkedList.h.

PSyton
  • 908
  • 11
  • 18