1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
|
//Header file
#ifndef OBJECKT
#define OBJECKT
#include <string>
#include "date.h" //This is
//using namespace swirly_D;
namespace swirly_objeckt
{
class objeckt
{
public:
objeckt(std::string name, std::string descrip, int category, int priority,float prog, /*date begin=date(), date due=date(), */
float timeNeeded=10/*string res[15],*/);
std::string nameC(std::string input);
std::string desC(std::string input);
std::string get_name()const{return name;}
std::string get_descrip()const{return descrip;}
void set_name();
void set_descrip();
private:
std::string name;//a
std::string descrip;//b
};
}
#endif
//implementation file
#include "Objeckt.h"
#include "date.h"
#include <iostream>
#include <cstdlib>
#include <string>
#include <cstring>
using namespace std;
using namespace swirly_D;
/*To do
find where
xx=yy
xy=something(error 2039)
no constructor?
*/
namespace swirly_objeckt
{
objeckt::objeckt(std::string name, std::string descrip, int category, int priority, float timeNeeded, float prog )
{
//std::string strcpy( std::string name,"name");
name ="name";
//std::string strcpy (std::string descrip, "Description");
descrip = "Description";
category;
priority =0;
timeNeeded=10;
prog;
}
std::string objeckt::nameC(std::string input/*,std::string name*/)
{
std::string strcpy(name,input);
return name;
}
std::string objeckt::desC(std::string input/*, std::string descrip*/)
{
std::string strcpy(descrip,input);
return descrip;
}
//similar functions
}
//application file
#include <iostream>
#include <fstream>
#include <cstdlib>
#include "Objeckt.h"
using namespace std;
using namespace swirly_objeckt;
int main()
{
objeckt o1;// Error here is: ObjecktApp.cpp no matching function for call to //`swirly_objeckt::objeckt::objeckt()'
int choice, menu;
ofstream outFile;
cin>>choice;
switch(menu)
{
case 1:
{
switch (choice)
{
case 1:
{
string input;
cout<<"Enter the new name of the objective"<<endl;
cin>>input;
o1.nameC(input);
break;//I have several more functions in this format
}//one for each variable in the constructor
break;
}
}
return 0;
}
}
|