0
#include<iostream>
#include<iomanip>
#include<string>



class Pizza{
public:
	std::string type;
	std::string size;
	int toppings;
	
	Pizza(){}

	void setType(std::string type){
	type = type;
}


	std::string getType(){
	return type;
}

	void setSize(std::string size){
	size = size;
}

	std::string getSize(){
	return size;
}

	void outputDescription(){
		//cout<<"A " cout<<getType(); cout<<" pizza;
	}
};

int main(){
	Pizza large = new Pizza();
	large.setType("pan");
        large.setSize("large");


	return 0;

}

In visual studio, I get this error: error C2440: 'initializing' : cannot convert from 'Pizza *' to 'Pizza. What is causing the problem?

2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by SolidSora
0

You might start by changing line 38 to say

Pizza* large = new Pizza();
large->setType("pan");
large->setSize("large");
delete large;

Edited by arkoenig: Added last three lines of code

0

I resolved the externals error. It appears I did something wrong when creating the project. I put the class in a new project and now it works.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.