Return value unable to be converted when no such conversion is needed.

Hello all,

I am posting this before I go to sleep after spending a good amount of time on this issue before posting here.

When I normally code in C# using Forms I always setup my application using the MVC pattern. I am trying to do this with C++ the same way and running into issues.

So in short my ApplicationController will house a reference to all my ViewController's, and the ViewControllers have the View within them. By the way, View == Form for those wondering.

The problem is with one function, and its getView() which returns my View so I can do something with it.

Thanks to all for any help, the problem is below.

I am getting this error.

Error 1 error C2440: 'return' : cannot convert from 'ProjectFive::HomeView' to 'ProjectFive::HomeView' C:\Users\v8beast\Documents\Visual Studio 2010\Projects\C++\Project Five\Project Five\HomeViewController.cpp 17 1 Project Five

Here is the code which is needed to debug this.

HomeViewController.h
1
2
3
4
5
6
7
8
9
10
11
12
#include "stdafx.h"
#include "HomeView.h"

public ref class HomeViewController
{
private:
	ProjectFive::HomeView view;
public:
	HomeViewController();
	~HomeViewController();
	ProjectFive::HomeView getView();
};


HomeViewController.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include "stdafx.h"
#include "HomeViewController.h"
#include "HomeView.h"

HomeViewController::HomeViewController()
{

}

HomeViewController::~HomeViewController()
{

}

ProjectFive::HomeView HomeViewController::getView()
{
	return this->view;
}
Your posted code IS NOT C++, there is no public ref class construct inh standard C++. Ask this in MSDN forums.
Mmm, that does look like C++/CLI. We don't have a lot of people on here who know anything much about it, so the MSDN forums would be a better bet than here.

Good luck!

-Albatross
Topic archived. No new replies allowed.