hey every1
slight problem with casting if u could spare the time to have a quick look and c wat is going wrong
thanks alot
i thought that this should work but i get two errors:Code:class JppVariable{ public: string name; string type; }; class JppSimple: public JppVariable{ public: int simple; JppSimple(string _name, string _type, int _value); }; JppSimple::JppSimple(string _name, string _type, int _value){ name = _name; type = _type; simple = _value; } //small but simple inheritance tree //later i try this vector <JppVariable> Variables; JppSimple test = JppSimple("anything", "SIMPLE", 5); Variables.push_back(test); JppSimple temp = static_cast<JppSimple>(Variables[0]);
error C2440: 'static_cast' : cannot convert from 'class JppVariable' to 'class JppSimple'
error C2512: 'JppSimple' : no appropriate default constructor available
can anyone tell me where i am going wrong
thanks for your time
rxg00u



LinkBack URL
About LinkBacks


