Skip to content
Advertisement

qualified reference to ‘Edge’ is a constructor name rather than a type in this context [closed]

I don’t know Java at all, but I need this program in C++. Can anyone help me convert it? I know OOP in C++, but I’m used to another syntax and do not understand exactly what and how to modify it.

JavaScript

I tried to do that and I optinut the code below:

JavaScript

But the code that I got myself, has a number of errors

here’s my code in full

Advertisement

Answer

In the case of your mentioned error 1 and 3, “qualified reference to ‘Edge’ is a constructor name rather than a type in this context” that you mention in your question title the error is because you are using the constructor where the compiler would expect to see a type.

You have:

JavaScript

So when you refer to Graph::Edge that is the class, but Graph::Edge::Edge is the constructor function.

Replace your usage of Graph::Edge::Edge with Graph::Edge to solve that error.

You also have problems where you mix vectors of pointers and vectors of instances.

Your final error 4 is because you are not using the constructor that you have defined (wrong parameters).

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement