hi everyone i would appreciate if any of you could help me out... i started not too long ago to program and today it seems i am stuck... i am trying to print a name and a birthday date by using classes, and my files are the following:
main:
#include <iostream>
#include "birthday.h"
#include "people.h"
using namespace std;
int main()
{
birthday birthObj(24,9,1985);
people MA("Teoras ", birthObj);
class people
{
public:
people(string x, birthday bo);
void printInfo();
protected:
private:
string name;
birthday dateOfBirth;
};
#endif
--------------------------------------
people.cpp:
#include "people.h"
#include "birthday.h"
#include <iostream>
using namespace std;
people::people()
: name(x), dateOfBirth(bo)
{
}
void people::printInfo(){
cout << name << " was born on ";
dateOfBirth.printDate();
}
-----------------------------------------
birthday.h:
#ifndef BIRTHDAY_H
#define BIRTHDAY_H
class birthday
{
public:
birthday(int m, int d, int y);
void printDate();
protected:
private:
int month;
int day;
int year;
};
#endif
------------------------------------------
birthday.cpp:
#include "birthday.h"
#include <iostream>
using namespace std;
birthday::birthday(int m,int d, int y)
{
month = m;
day = d;
year = y;
}
void birthday::printDate()
{
cout << month << "/" << day << "/" << year << endl;
}
-----------------------------------------
the error seems to be on the people.cpp file, in the line ": name(x), dateOfBirth(bo)"
and the error messages quote:
||=== Build: Debug in spain (compiler: Microsoft Visual C++ 2010) ===|
people.cpp|7|error C2511: 'people::people(void)' : overloaded member function not found in 'people'|
people.cpp|14|fatal error C1004: unexpected end-of-file found|
||=== Build failed: 2 error(s), 0 warning(s) (0 minute(s), 1 second(s)) ===|
for the life of me i cannot see what i am doing wrong, could anyone please help me out here? i would be really thankful...
thanks in advance!!
hi there guys thank you very much for your help, i could not reply before cos i was working until now... right, i tried by passing the parameters like you two said above and no error was given, the program compiled and ran, but now what i do not understand is why is not printing anything on the screen!?? i am going crazy guys, have you got any idea of why this could be?
thanks again...
haha, sorry guys for the last post i suppose i was just too sleepy last night, had a long shift at work, i just got my hands on it and so what was missing from it hehe, stupid mistake, nonetheless thank you both for your help with the first problem, i really appreciate it :)