Hi,

Thank you for your support. I am new to C++ and have started working with classes. I understand constructors, accessors and mutators. I have a program that I am working on and I am implementing my classes. I have six classes and have completed four. The top two, Calendar and appointment require me to have functions from my other classes (i.e. in class appointment, Time getstarttime or Location getLocation.) Can anyone help me on how to implement these? Also I am a bit confused in passing a vector through a constructor. any help will be much appreciated! Thank you. I have pasted my code:

class Calendar
    {
    public:
        Calendar();
        Calendar(Appointment mname);
        void AddToCalendar(Appointment mname);
        void RemoveFromCalendar(Appointment mname);
    private:
        vector < Appointment > meetings;
    }; // Calendar
   

 
    class Appointment
    {
    public:
        Appointment();
        Appointment(vector< person > alist, Time stime, Time etime, Date d, Location p);
        vector< Person > getAttendees()
        Time getStartTime()
        Time getEndTime()
        Date getDate()
        Location getLocation();
    private:
        vector< Person > attendees;
        Time starttime;
        Time endtime;
        Date date;
        Location place;
    }; // Appointment
   

 
    class Person
    {
    public:
        Person();
        Person(string firstname, string lastname, string company);
        string getFirstName();
        string getLastName();
        string getCompany();
    private:
        string firstname;
        string lastname;
        string company; 
    }; // Person

	Person::Person(string firstname, string lastname, string company);
	{ this -> lastname = lastname;
	  this -> firstname = firstname;
	  this -> company = company;
	}
	
	string Person::getFirstName()const;
	{ return firstname;}

	string Person::getLastName()const;
	{ return lastname;}

	string Person::getCompany()const;
	{return company;}

   



 
    class Location
    {
    public:
        Location();
        Location(string address, string building, string room);
        string getLocationAddress();
        string getLocationBuilding();
        string getLocationRoom();
    private:
        string address;
        string building;
        string room;
    }; // Location
	
	Location::Location(string address, string building, string room);
	{  this -> address = address;
	   this -> building = building;
	   this -> room = room;
	}

	string Location::getLocationAddress()const;
	{ return address;}

	string Location::getLocationBuilding()const;
	{ return building;}

	string Location::getLocationroom()const;
	{return room;}
   

    class Date
    {
    public:
        Date();
        Date(int month, int day, int year); 
        int GetMonth();
        int GetDay();
        int GetYear();
    private:
        int month;
        int day;
        int year;
    }; // Date

	Date::Date(int month, int day, int year);
	{  this -> month = month;
	   this -> day = day;
	   this -> year = year;
	}

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

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

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

    class Time
    {
    public:
        Time();
        Time(int hour, int minute);
        int GetHour();
        int GetMinute();
    private:
        int hour;
        int minute;
    }; // Time
   
	Time::Time(int hour, int minute)
	{  this -> hour = hour;
           this -> minute = minute;
        }
	
	int Time::GetHour()const;
	{ return hour; }

	int Time::GetMinute()const;
	{ return minute; }

thanks again,
wander

What's the question? Is it not compiling? Is this all one big file? Is it the whole file?

The main thing I see is that you have a bunch of semicolons in the implementation functions where they shouldn't be and you have a bunch of const declarations in your function implementation that don't match your declarations:

class Person
    {
    public:
        Person();
        Person(string firstname, string lastname, string company);
        string getFirstName();  // no const declaration
        string getLastName();
        string getCompany();
    private:
        string firstname;
        string lastname;
        string company; 
    }; // Person

	string Person::getFirstName()const; // delete semicolon
	{ return firstname;}

My question is that I havent implemented the top two classes appointment and Calendar. They are just the interface.

My question is that I havent implemented the top two classes appointment and Calendar. They are just the interface.

That's a statement, not a question. You have problems before you implement those two classes, so don't try to implement them before fixing those problems. Get what you have to compile first, then start adding to it. Add empty implementation methods if you need to to get them to compile. Some of the things you need to get it to compile are what I listed above. If, after doing that, you have more questions about how to implement those two classes, please ask a more specific question, along with updated code. I don't what you are asking.

This article has been dead for over six months. Start a new discussion instead.