I have class with this format:
class polarity {
public:
void method1();
void method2();
polarity();
~polarity();
private:
stack<type*> carbon;
vector<scientist*> sci;
};
here is method1:
void polarity::method1(){
type * object1;
object1 = new type();
unsigned int i;
for(i = 0; i <carbon.size() ; ++i){
object1 = carbon.pop();
/*Do something with object1*/
}
}
when I run the program I receive this error
Error 1 error C2440: '=' : cannot convert from 'void' to 'type *'
I do not understand what it means. I just fill stack with some pointer of type. but I cannot retrieve these pointer.
I would appreciate for any help.
type?std::stack... A quick search will tell you what thetop()and thepop()functions do.typeis a poor naming choice for a data structure.