LDSFSD 0 Newbie Poster

Hi can you help me to fix the error in Invoice class .h - " dt Unknown override specifier"

Date .h

#include "Stock.h"
#include "Invoice.h"
#include <ostream>
#include <iostream>

class Date {

    int month, day, year;

public:

    Date();

    Date(int _month, int _day, int _year);


    Date& setMonth(int _month);
    Date& setDay(int _day);
    Date& setYear(int _year);

    int getMonth() const;
    int getDay() const;
    int getYear() const;

    void showDate();

    friend std::ostream& operator<<(std::ostream& ou, const Date& d);
};

Date cpp

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


Date::Date() {

    month = 0;
    day = 0;
    year = 0;
}

Date::Date(int _month, int _day, int _year) {

    month = _month;
    day = _day;
    year = _year;
}


Date& Date::setMonth(int _month)
{
    month = _month;
    return *this;
}

Date& Date::setDay(int _day)
{

    day = _day;
    return *this;
}

Date& Date::setYear(int _year)
{
    year = _year;
        return *this;
}

//getters

int Date::getMonth() const
{
    return month;
}

int Date::getDay() const
{
    return day;
}

int Date::getYear() const
{
    return year;
}

void Date::showDate()
{
    std::cout <<"Month " << month << " / " <<"Day "<< day << " / " << "Year "<<year << std::endl;
}

std::ostream& operator << (std::ostream& ou, const Date& d)
{
    ou << "\nMonth : " << d.getMonth();
    ou << "\nDay : " << d.getDay();
    ou << "\nYear : " << d.getYear();
        return ou;
}

Invoice .h

#include"Stock.h"
#include "Date.h"
#include <string>
#include<map>
#include <iomanip>
#include <sstream>
#include<iostream>
#include <algorithm>

class Invoice 
{
    int numberInvoice;
    //int dateIssue;
    Date dt; 
    std::map<Stock, double> goods;
public:
    Invoice() ;
    Invoice(int _numberInvoice, Date _dt, std::map<Stock, double> _goods);
    int getNumberInvoice() const;
    Date getDate()const;

    std::map<Stock, double> getGoods() const;

    void setNumberInvoice(int _numbInvoice);

    Invoice& setDate(Date _date);

    void setGoods(std::map<Stock, double> _goods);

    void addGood(Stock s);
    void display()const;
    void showByCode(int code);
    void calcGoods();
};

Invoice cpp

#include "Invoice.h"
#include "Date.h"
Invoice::Invoice()
{
}

Invoice::Invoice(int _numberInvoice, Date _dt, std::map<Stock, double> _goods)
{
    numberInvoice = _numberInvoice;
    dt = _dt;
    goods = _goods;
}

int Invoice::getNumberInvoice() const
{
    return numberInvoice;
}


Date Invoice::getDate() const
{
    return dt;
}

std::map<Stock, double> Invoice::getGoods() const
{
    return goods;
}

void Invoice::setNumberInvoice(int _numbInvoice)
{
    numberInvoice = _numbInvoice;
}


Invoice& Invoice::setDate(Date _dt) {
    dt = _dt;
    return *this;
}

void Invoice::setGoods(std::map<Stock, double> _goods)
{
     goods = _goods;
}


void Invoice::addGood(Stock s)
{

}

void Invoice::display() const
{
    std::cout << "\nInvoice " << numberInvoice << '\n';
    std::cout << "Date of issue " << dt << '\n';
    std::cout << "Goods:\n";

        for (const auto& kv : goods) {
            std::cout << kv.first <<"Has value: "<< kv.second<< std::endl;
        }
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.