I'm beginner in OOP and I have problem with definition of constructor. headfile.h:
#ifndef RACHUNEK_H_INCLUDED
#define RACHUNEK_H_INCLUDED
#include <string>
class Rachunek
{
std::string surname;
std::string nr_account;
double balance;
public:
Rachunek();
Rachunek(std::string & name,std::string & nr,double s = 0.0);
~Rachunek(){};
void show();
void give(const double m);
void get(const double m);
};
#endif // RACHUNEK_H_INCLUDED
file .cpp:
#include <iostream>
#include <string>
#include "rachunek.h"
using namespace std;
Rachunek::Rachunek() //default
{
surname = "not specified";
nr_account = "0000-0000-0000-0000";
balance = 0.0;
}
Rachunek::Rachunek(string & name, string & nr, double s = 0.0) //mysecond
{
surname = name;
nr_account = nr;
balance = s;
}
the problem is the definition of a constructor. I don't know what is wrong...