After creating a class called student i aslo include a constructor and destructor the implementation code is shown below.

student::student(){;}
student:: ~student(){;}

but i still have an error message as -
" return type specification for constructor invalid"
can any one help me figure whats wrong ??

Recommended Answers

All 4 Replies

Do you have any other constructors? (overloaded)
If not, post more code.

Implementation looks pretty fine. Post the declaration too.
BTW, the declaration should be

class student{
public:
        student();
        ~student();
        //other stuff
}

[psychic debugging]
You probably forgot to terminate your class definition with a semicolon and the constructor definition immediately follows it. The following code should produce a similar error:

class foo {
public:
  foo();
}

foo::foo() {}

The error is saying that the constructor for foo is trying to use the type foo (specified by a class definition) as the return type for the constructor. However, a constructor doesn't have a return type, so the compiler issues a diagnostic.
[/psychic debugging]

thanks for the help...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.