#include"stdafx.h"
#include<iostream>
#include<ctime>
#include<cstddef>
#include<fstream>
using namespace std;
class person
{
char *name;
public:
person(){};
void set_name(char *nam)
{
name=nam;
}
char* get_name()
{
return name;
}
};
class student:public person
{
int year_of_joining;
int rollno;
char *stream;
public:
student(int year,int roll,char *str,char *nam);
student *next,*prev;
};
student::student(int year,int roll,char *str,char *nam)
{
year_of_joining=year;
rollno=roll;
stream=str;
this->set_name(nam); next=NULL;
prev=NULL;
}
class linklist
{
files *f;
student *start,*temp; public:
linklist(int year,int roll,char *str,char *nam);
void append(int year,int roll,char *str,char *nam);
char* show_name();
};
char* linklist::show_name()
{
return temp->get_name();
}
linklist::linklist(int year,int roll,char *str,char *nam)
{
student *ptr=new student(year,roll,str,nam);
start=ptr;
temp=ptr;
}
void linklist::append(int year,int roll,char *str,char *nam)
{
student *ptr1=new student(year,roll,str,nam);
temp->next=ptr1;
ptr1->prev=temp;
temp=ptr1;
}
class files
{
ifstream *in;
ofstream *out;
public:
files();
};
int main()
{
linklist l(2009,1809317,"cse","bhawin");
l.append(2009,1809315,"cse","anshul");
return 0;
}
in the above code there is a problem at first private member of class linklist
the error says:missing type specifier - int assumed. Note: C++ does not support default-int
and the second error is - syntax error : missing ';' before '*'
i just can't understand why i cant add class object file class as a private member of linklist class