Reputation: 1307
I want to write a static member function in my class CountInv, which should have only this static function and no other members
//Inversions.h
#ifndef INV_H
#define INV_H
#include <string>
#include <vector>
class CountInv
{
static void count();
}
#endif
//Inversions.cpp
#include "Inversions.h"
void CountInv::count() { return; };
I get the following compiler error :
Error 3 error C2556: 'CountInv CountInv::count(void)' :
overloaded function differs only by return type
from 'void CountInv::count(void)' d:\...\inversions.cpp 4
What is wrong? Nowhere have I declared or defined 'CountInv CountInv::count(void)' !! Should I write class c-tors,..,d-tors, or maybe some static data members to return from this function? but this should not be the issue..
Upvotes: 2
Views: 2714
Reputation: 1968
I tried this on my local visual studio and adding semicoln in Inversions.h after class definition solves problem.
Thanks Niraj Rathi
Upvotes: -1
Reputation: 234665
Don't forget the closing semicolon ;
after your class definition. That I think is causing the obscure compile error.
Upvotes: 6