okay all I'm a little rusty on class inheritence here so if you could all refresh my memory please I have the following classes here
the constructor recieves two values an integer and a double so if that is the case how do you build the constructor for the derived class.
here is main
here is the headerCode:#include<iostream> #include <iostream> #include "Score.h" void main() { numbers p(1, 0); p.createlist(); cout<<"TRY THIS ON"; }
now I'm a bit rusty so I kind of forgot the correct syntax for linking the constructor for the derived class to the Base classCode:#ifndef Score #define Score #include <fstream> using namespace std; // Number *num = new Number(5.3); class numbers { public: fstream f; struct node { double value; int type; node *next; node *back; }; numbers(int category, double value ) { int m=category; //this is your category; double n=value;//this is your value; } void createlist() { node* list=NULL; node *p, *r, *q; int m; double n; f.open("f.txt", ios::in); while(!f.eof()) { if(list==NULL) { f.seekp(0, ios::beg); f>>m; f.seekp(1, ios::cur); f>>n; p=new(node); p->type=m; p->value=n; list=p; p->next=NULL; p->back=list; } else if(list==p) { f.seekp(1, ios::cur); f>>m; f.seekp(1, ios::cur); r=new(node); f>>n; p->next=r; r->type=m; r->value=n; r->back=p; r->next=NULL; p=p->next; } else { f.seekp(1, ios::cur); f>>m; f.seekp(1, ios::cur); f>>n; r=new(node); r->back=p; r->next=NULL; p->next=r; r->value=n; r->type=m; p=p->next; } } } }; class Score : public numbers { public: Score(int a, double b):numbers(int category, double value) { int a=category; double val=value; } }; #endif
any advice is welcome here



LinkBack URL
About LinkBacks


