error. new types may not be defined in a return type. line 15
Sep 15, 2012 at 5:51pm
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 Sep 15, 2012 at 5:53pm
Sep 15, 2012 at 6:00pm
Class declarations must be terminated with a semicolon.
Sep 15, 2012 at 6:04pm
i did that, now the error occurs at 29.
Sep 15, 2012 at 6:09pm
abc A;
int num;
cin>>num;
cout<<A.geta(num)<<endl;
Sep 15, 2012 at 6:21pm
int geta(); //doesn't have parameter
Topic archived. No new replies allowed.