c++ - Different matrix structs passed by parameter -
I have a function in a genericObject class that needs to be a struct as a parameter, but going to this struct All these structs are provided by one of their child classes to be the same member, but they will have different matrix sizes This function meets the structs (obviously incorrect). structure example: and should work in some way like this: How can I do this? Thanks in advance. structs are all single members, so why is it redefined in children's classes? I think the answer to this question "Different matrix sizes" means that they are a 2D that is array member who has a different static declaration shape, in other words, they are not a single member Are there. Three solutions. If the members of your strokes have all the same names, then it should only be sufficient: Obviously because this is a template, the function definition is to appear in your header file instead of .cpp.
GenericObject Zero :: SetTexture (struct * _myStructOffset) {for (int i = 0; i & lt; stateNumber; i ++) {(for int j = 0; j & LT; indexNumber; J ++) {SetTextureOffset (i, j, _mystructOffset [i] [j] -> xTex0, _myStructOffset [I] [J] -> xTex1, _myStructOffset [I] [J] - & Gt; yTex0, _myStructOffset [I] [J] -> yTex1, 100 / * _ myGenericOffset-> imageW * /, 100 / * _ myGenericOffset-> imageH * /); } GetMyAnimatedSprite () - & gt; Set animationist (); }}
struct button data {float xTex0; Float yTex0; Float Extex 1; Float yTex1; } Button Offset 1 [3] [1];
Zero button :: SetTexture () {GenericObject :: SetTexture (& ButtonOffset1); }
template & lt; Typename STRUCT_T & gt; Zero GenericObject :: SetTexture (struct STRUCT_T * _mystructOffset) {...}
Comments
Post a Comment