May 29, 2011 at 4:22pm UTC
hello, I am a newb at C++, and I am sorry for the layout, no indet or apropriate names for anything (class, doubles, int, etc) + the program is very sketchy, nothing is final.
I need to use inheretance for template, I've marked where the problem is. Basically, ONEDAY needs to inherit the propreties of "NORMAL ()", the idea is that "NORMAL" does a simple KG*GC calculation and ONEDAY needs to do KG*GC*10
thank you very much!
edit 3:
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
#include <iostream>
#include <ostream>
#include <string>
using namespace std;
template <class PACKAGE_1>
class DATA_EXP_DES_2{
PACKAGE_1 DATA_EXP_NAME_3,DATA_EXP_ADRESS_4;
public :
DATA_EXP_DES_2(PACKAGE_1 Z_25_5,PACKAGE_1 Z_25_6){DATA_EXP_NAME_3=Z_25_5,DATA_EXP_ADRESS_4=Z_25_6;}
void INSERT_DATA_EXP_7 (){
getline(cin,DATA_EXP_NAME_3);
getline(cin,DATA_EXP_ADRESS_4);
cout<<"DATA_EXP_NAME_3 IS " << DATA_EXP_NAME_3 << "\n" ;
cout<<"DATA_EXP_ADRESS_4 IS " << DATA_EXP_ADRESS_4 << "\n" ;
};//void INSERT_DATA_EXP_7
};//class DATA_EXP_DES_2
template <class PACKAGE_1>
class KG_GC_8{
PACKAGE_1 KG_9,GC_10;
public :
KG_GC_8(PACKAGE_1 Z_25_5,PACKAGE_1 Z_25_6){KG_9=0,GC_10=0;}
void KG_GC_INSERT_11 ();
void KG_GC_VIEW_12 ();
void CALC_COST_N_13 ();
};//class KG_GC_8{
template <class PACKAGE_1>
void KG_GC_8<PACKAGE_1>::KG_GC_INSERT_11 (){
cout<<"KG_9:" ;cin>>KG_9;
cout<<"GC_10:" ;cin>>GC_10;
}//void KG_GC_INSERT_11
template <class PACKAGE_1>
void KG_GC_8<PACKAGE_1>::KG_GC_VIEW_12 (){
cout<<"KG_9:" <<KG_9<<"\n" ;
cout<<"GC_10:" <<GC_10<<"\n" ;
}//void KG_GC_INSERT_11
template <class PACKAGE_1>
void KG_GC_8<PACKAGE_1>::CALC_COST_N_13 (){
cout<<"CALC_COST_N_13_COST:" <<KG_9*GC_10<<"\n" ;
}//void CALC_COST_N_13
//--------------------------------------here is the problem
template <class PACKAGE_1>
class ONEDAY: public KG_GC_8{
public :
void ONEDAY_1 (): KG_GC_8
}
template <class PACKAGE_1>
void ONEDAY_1<PACKAGE_1>::ONEDAY (){cout<<"ONEDAY:" <<10<<"\n" ;}
}; //class ONEDAY
//--------------------------------------here is the problem
int main(){
int A0=0;
do {cout<<"CHOOSE PROGRAM NUMBER:25\n" ;int B0=25;switch (B0){
case 1:{cout<<"0=EXIT\n1=COMMAND LIST\n25=2505111-T2-2-1\n" ;break ;}
case 0:{return 0;}
case 25:{
int Z_25_14=0;cout<<"TYPE 1:" ;cin>>Z_25_14;cout<<endl;cin.ignore();//clear buffer
string NAME_EXP_TEMP_15, ADRESS_EXP_TEMP_16;
DATA_EXP_DES_2<string> EXP_TEMP_17(NAME_EXP_TEMP_15,ADRESS_EXP_TEMP_16);
EXP_TEMP_17.INSERT_DATA_EXP_7();
double KG_TEMP_18 = 0,GC_TEMP_19 = 0;
KG_GC_8<double >KG_GC_TEMP_20(KG_TEMP_18,GC_TEMP_19);
KG_GC_TEMP_20.KG_GC_INSERT_11 ();
KG_GC_TEMP_20.KG_GC_VIEW_12 ();
KG_GC_TEMP_20.CALC_COST_N_13 ();
break ;}//switch B0=25
}//switch B0
}while (1);//doodoo
return 0;//TEMP 17-1-1
}//main
Last edited on May 29, 2011 at 7:58pm UTC
May 29, 2011 at 4:53pm UTC
please don't use commands that I probably won't know
This is an invalid request, the aim of this forum is to educate you first and answer questions in the process of doing so. How will you learn something new if you only keep doing the same thing?
Constructors don't have explicitly declared return types.
Your constructor has a close bracket on Line 49 but no open bracket?
Classes cannot be member functions of other classes... In other words WTH are you doing on Line 51?
Last edited on May 29, 2011 at 4:53pm UTC
May 29, 2011 at 5:23pm UTC
+1 to Computergeek01. Besides, how can I possibly know what you don't know so as to avoid using it??
May 29, 2011 at 6:35pm UTC
sorry when I google something I get huge, long "references" like for template, it also includes several commands that aren't clear to me...
to be honest I bearly know how the inheretance on templates work, that's why I'm asking...
May 30, 2011 at 3:53am UTC
Indent your code.
¿what is the problem?