Search the Community
Showing results for tags 'constructor'.
-
Hi all, Im building a variant class that I want to make work, but Im running into compiler issues; issues that highlight that I have no idea what is going on under the hood for operators in C++. My class looks something like: class Variant { public: //Constructors Variant(void) : type(VAR_INTTYPE), int64value(0), databuffsize(0), databuff((char*)0) {} Variant(int); Variant(long long); Variant(double); Variant(const char* in); Variant(char* in); Variant(Variant & in);//Copy Constructor ~Variant();//Destructor //Operators Variant& operator= (Variant&); Variant& operator= (Variant); //Other irrelvant code... } And Im trying to do things like: Variant test; int main() { test = Variant(20); //btw, I have no intention of implementing assignment ops for primitive types for various reasons Variant lol(7); lol = test; return 0; } In GCC (mingw) this is throwing errors like: Any ideas what constructors or operators I am missing? I have looked around and cannot find any solution to my problem. Thanks in advance.