What is wrong with this??
It seems fine to me and uit gives me this error:
20 return type specification for constructor invalid
Main.cpp:
Alarm.h:Code:#include <iostream> #include <stdlib.h> #include "alarm.h" int main(int argc, char *argv[]) { Alarm bug(4, BURGLAR); cout<<"4 Burglar alarms were installed\n"; system("PAUSE"); return 0; }
Code:#ifndef ALARM_H #define ALARM_H #include <iostream.h> enum TYPE {FIRE, BURGLAR}; class Alarm { public: Alarm(); Alarm(int amount, TYPE type); ~Alarm(); private: int theAm; TYPE itsType; } Alarm::Alarm() { cout<<"Constructer called...\n"; } Alarm::Alarm(int amount, TYPE type) { theAm = amount; itsType = BURGLAR; cout<<"Constructer called...\n"; } Alarm::~Alarm() { cout<<"Destructor called...\n"; } #endif



LinkBack URL
About LinkBacks



Have a nice day.