error. new types may not be defined in a return type. line 15

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
#include <cstdlib>
#include <iostream>

using namespace std;

class abc
{
public:
       void Seta(int b);
       int geta(); //fucntion that acesses private variable.
private:
        int a;
}

void abc::Seta(int b)
{ 
     a=b;
}
int abc::geta()
{ 
      return(a);
}

int main(int argc, char *argv[])
{
    class A;
    int num;
    cin>>num;
    cout<<A.geta(num)<<endl;

    system("PAUSE");
    return EXIT_SUCCESS;
}

Last edited on
Class declarations must be terminated with a semicolon.
i did that, now the error occurs at 29.
abc A;
int num;
cin>>num;
cout<<A.geta(num)<<endl;
int geta(); //doesn't have parameter
Topic archived. No new replies allowed.