Can't convert struct hi to Chi*
-
Below i'm trying to give my code structure, so that it can understandable I've a class named "Chi", i've taken a ptrvariable to that class(hi), say tp; tr, is simple class variable( of "hi") now i've a structure called "hi"... i've a list to store the all structure variable.... now i want to store the tr(variable of Chi) in that list, nd then it gives me the error...[Can't convert struct hi to Chi*] my code in brief:: class Chi:public someclass {...... ......}// this is the cpp file in .h file i declare a variable of class Chi, and i have struct hi {....... ........} it' ll very plesure to me, if ny body let me know the exact way to store in this way........ ok...Good day to all off u......... kamalesh
-
Below i'm trying to give my code structure, so that it can understandable I've a class named "Chi", i've taken a ptrvariable to that class(hi), say tp; tr, is simple class variable( of "hi") now i've a structure called "hi"... i've a list to store the all structure variable.... now i want to store the tr(variable of Chi) in that list, nd then it gives me the error...[Can't convert struct hi to Chi*] my code in brief:: class Chi:public someclass {...... ......}// this is the cpp file in .h file i declare a variable of class Chi, and i have struct hi {....... ........} it' ll very plesure to me, if ny body let me know the exact way to store in this way........ ok...Good day to all off u......... kamalesh
kamalesh82 wrote:
I've a class named "Chi", i've taken a ptrvariable to that class(hi), say tp; tr, is simple class variable( of "hi")
:omg: This is not clear at all: it is really confusing what you are trying to explain: Chi, hi, tp, tr, "hi", ... :confused: Put some code (with a short description if required) and a precise question.
Cédric Moonen Software developer
Charting control -
kamalesh82 wrote:
I've a class named "Chi", i've taken a ptrvariable to that class(hi), say tp; tr, is simple class variable( of "hi")
:omg: This is not clear at all: it is really confusing what you are trying to explain: Chi, hi, tp, tr, "hi", ... :confused: Put some code (with a short description if required) and a precise question.
Cédric Moonen Software developer
Charting controlI couldn't make head or tail out of it either. Steve
-
Below i'm trying to give my code structure, so that it can understandable I've a class named "Chi", i've taken a ptrvariable to that class(hi), say tp; tr, is simple class variable( of "hi") now i've a structure called "hi"... i've a list to store the all structure variable.... now i want to store the tr(variable of Chi) in that list, nd then it gives me the error...[Can't convert struct hi to Chi*] my code in brief:: class Chi:public someclass {...... ......}// this is the cpp file in .h file i declare a variable of class Chi, and i have struct hi {....... ........} it' ll very plesure to me, if ny body let me know the exact way to store in this way........ ok...Good day to all off u......... kamalesh
You have to understand the sense behind converting data. For instance: class A : public B { } class C //or struct { } You can: A *p = new A; B *p1 = (B*) p; //because A inherits B !!! you cant B *p2 = (B*) new C;///Bullshit C isnt a B (or A) because C is NOT a B. You can store any data type in a void*, but you have to cast it with a legal cast to a object. I guess you a learning working with pointers? X| Greeting from Germany