Run the code to see where the problem lies.
[Error] 'd' does not name a type
I tried declaring the variable directly in public but it kept popping up with more errors.
There seems to be apparently no fix, since googling didn't help much in the process.
It'd be super helpful if someone could help me figure out where the problem is.
#include<iostream>
using namespace std;
class array1{
protected:
static int a[50];
public:
int n1;
void getNum1(void)
{
cout<<"how many numbers?"<<endl;
cin>>n1;
for(int i=0;i<n1;i++)
{
cout<<"enter le number"<<endl;
cin>>a[i];
}
}
int* retNum1(void)
{
return a;
}
};
class array2{
protected:
static int b[50];
public:
int n2;
void getNum2(void)
{
cout<<"how many numbers?"<<endl;
cin>>n2;
for(int i=0;i<n2;i++)
{
cout<<"enter le number"<<endl;
cin>>b[i];
}
}
int* retNum2(void)
{
return b;
}
};
class conarray:public array1, public array2{
private:
int c[100],d;
//int d;
public:
d=0;
void disp()
{
for(int i=0;i<5;i++)
{
cin>>c[i];
}
for(int i=0;i<5;i++)
{
cout<<c[i]<<endl;
}
cout<<d;
}
//int d = 0;
/*void merge(void)
{
int *nn1 = retNum1();
int *nn2 = retNum2();
for(int i=0;i<n1;i++)
{
c[d]=nn1[i];
d++;
}
for(int i=0;i<n2;i++)
{
c[d]=nn2[i];
d++;
}
}
void display(void)
{
cout<<"NUMBERS IN ARRAY:"<<endl;
for(int i=0;i<d;i++)
{
cout<<c[i]<<endl;
}
}*/
};
int main()
{
conarray a;
//a.getNum1();
//a.getNum2();
//a.merge();
//a.display();
a.disp();
return 0;
}