Class with members as classes
hey ppl ive got a little problem here...
Code:
#ifndef _EVENT_H_
#define _EVENT_H_
class Time;
class Date;
class Event
{
private:
Date inputDate;
Time startTime;
int inputTimeInterval;
Time endTime;
std::string eventName;
std::string eventLocaton;
std::string eventComments;
public:
Event();
~Event();
void printEvent();
}
#endif
--------------------------------------------
this is my class for event
ive declared another class (like date and time) as its members...
does this method of forward declaration works...
how would i initialize Event() constructor???
Re: Class with members as classes
Quote:
Originally posted by justdoit22
does this method of forward declaration works...
No. In this case you need the actual class definition, not just a declaration. Forward declarations will only let you refer to an instance of the class indirectly (IE via pointers and references).
Quote:
Originally posted by justdoit22
how would i initialize Event() constructor???
Rephrase that