0

This is my Node.h file

#ifndef NODE_H_INCLUDED
#define NODE_H_INCLUDED

using namespace std;

class Node
{
    private:
        int rollNumber;
        string FName; // first name
        string LName; // last name
        string Batch;
        float gpa;

        int height; // height of node
        int balanceFactor;

        Node * lc; // left child
        Node * rc; // right child

    public:
        // constructor
        Node(int in_rollNum, string in_fn, string in_ln, string in_batch, float in_gpa);
};

#endif // NODE_H_INCLUDED

and this is my Node.cpp file

#include<iostream>
#include "Node.h"

// constructor definition
Node::Node(int in_rollNum, string in_fn, string in_ln, string in_batch, float in_gpa)
{
    rollNumber = in_rollNum;
    FName = in_fn;
    LName = in_ln;
    Batch = in_batch;
    gpa = in_gpa;

    height = 0;
    balanceFactor = 0;

    lc = NULL;
    rc = NULL;
}

I am getting an error of multiple definition of Node constructor, please point out the mistake or correct it. I want the header and .cpp files separately so that is why I was doing it like this, I do know how to do it in the same file. But, I want the declaration and implementation separately.

Mohammad Usman
  • 39
  • 1
  • 2
  • 9

0 Answers0