• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Quick C++ Question on VIsual C++

Kenji4861

Banned
I have two files


graph.cpp
#include <iostream.h>
#include "graph.h"

Graph::Graph(){
cout << "created";
}


graph.h
class Graph{

public:
Graph();

private:
int size;
}



This gives me an error :
error C2533: 'Graph::Graph' : constructors not allowed a return type
Why does it do that? Does VIsual C++ have different syntax than standard C++?
 
graph.cpp:

#include <iostream.h>
#include "graph.h"

Graph::Graph()
{
cout << "created";
}

graph.h:

class Graph{

public:
Graph();

private:
int size;
};

main.cpp: (to test it out)

#include "graph.h"

void main ()
{
Graph g;
}



Works for me under visual c++ .net
 
Back
Top