C++ Calling function that has template which has inheritance -
After
Then I have a class that defines a TileGrid:
of the template & Lt; Typename t & gt; Square tilegrid {...}; I fill the template with a class named ImageTile ImageTile {...}; I have a child class of ImageTile that I have defined that looks like this: class FFTWImageTile: public ImageTile {...}; In a separate file I define the following function:
Zero writeDataToFile (TileGrid & Image; ImageStitching :: ImageTile & gt; * Grid, std: : String file name); (Note: Both the ImageTile and FFTWImageTile are in the Image Stitching location) All of the above are now Just fine, but when I try to use it I get an error.
Here is an example test case that is using it:
Namespace = Image Stitching; TileGrid & LT; Is :: FFTWImageTile & gt; * Grid = new tilegrid & lt; Is :: FFTWImageTile & gt; (...); WriteTranslationsToFile (grid, "output.txt"); When the trial case I get the following error compilation:
error: can not change ???? TileGrid & LT; ImageStitching :: FFTWImageTile & gt; * One ???? For Tula Grid & lt; Image Stitching :: Imagatile & gt; * One ???? One for logic Zero writeTranslationsToFile to (; ImageStitching :: ImageTile> TileGrid & lt *, std :: string) a ???? Anyway I can do this in C ++ ??
Edit:
Each person has the answer that I am working on it. Was extraordinary and the solution to each submitted problem I think has been decided to move to C ++ 11 and use an emphasis for this particular case. In the future, I think I will add a template to the function and be sure to get the data in this way. Thanks to all for help! I have marked that what I think is the best answer, although each is acceptable.
You are getting the error that despite FFTWImageTile ImageTile < / Code> because, TileGrid & LT; FFTWImageTile & gt; and TileGrid & LT; ImageTile & gt; are perfectly unrelated classes. How it can be decided depends on the implementation of those classes which you have not shown. You may create writeDataToFile () templated: template & lt; Typename T & gt; Write zerodatafile (tilegred * grid, std :: string fileName);
Comments
Post a Comment