Advertisement
Guest User

Untitled

a guest
Jul 25th, 2014
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.22 KB | None | 0 0
  1. virtual void LoadCube(UtpBipCube<float> &Cube,long LowerLeftRow=0,long LowerLeftColumn=0,
  2. long UpperRightRow=-1,long UpperRightColumn=-1,long LowerBand=0,long UpperBand=-1) = 0;
  3. virtual void LoadCube(UtpBipCube<short> &Cube, long LowerLeftRow=0,long LowerLeftColumn=0,
  4. long UpperRightRow=-1,long UpperRightColumn=-1,long LowerBand=0,long UpperBand=-1) = 0;
  5. virtual void LoadCube(UtpBipCube<unsigned short> &Cube, long LowerLeftRow=0,long LowerLeftColumn=0,
  6. long UpperRightRow=-1,long UpperRightColumn=-1,long LowerBand=0,long UpperBand=-1) = 0;
  7.  
  8. template<class T>
  9. virtual void LoadCube(UtpBipCube<T> &Cube,long LowerLeftRow=0,long LowerLeftColumn=0,
  10. long UpperRightRow=-1,long UpperRightColumn=-1,long LowerBand=0,long UpperBand=-1) = 0;
  11.  
  12. virtual void LoadCube(UtpBipCube<float> &Cube,long LowerLeftRow=0,long LowerLeftColumn=0,
  13. long UpperRightRow=-1,long UpperRightColumn=-1,long LowerBand=0,long UpperBand=-1) = 0;
  14. virtual void LoadCube(UtpBipCube<short> &Cube, long LowerLeftRow=0,long LowerLeftColumn=0,
  15. long UpperRightRow=-1,long UpperRightColumn=-1,long LowerBand=0,long UpperBand=-1) = 0;
  16. virtual void LoadCube(UtpBipCube<unsigned short> &Cube, long LowerLeftRow=0,long LowerLeftColumn=0,
  17. long UpperRightRow=-1,long UpperRightColumn=-1,long LowerBand=0,long UpperBand=-1) = 0;
  18.  
  19. void LoadCube(UtpBipCube<float> &Cube, long LowerLeftRow=0,long LowerLeftColumn=0,
  20. long UpperRightRow=-1,long UpperRightColumn=-1,long LowerBand=0,long UpperBand=-1)
  21. { LoadAnyCube(Cube,LowerLeftRow,LowerLeftColumn,UpperRightRow,UpperRightColumn,LowerBand,UpperBand); }
  22.  
  23. void LoadCube(UtpBipCube<short> &Cube, long LowerLeftRow=0,long LowerLeftColumn=0,
  24. long UpperRightRow=-1,long UpperRightColumn=-1,long LowerBand=0,long UpperBand=-1)
  25. { LoadAnyCube(Cube,LowerLeftRow,LowerLeftColumn,UpperRightRow,UpperRightColumn,LowerBand,UpperBand); }
  26.  
  27. void LoadCube(UtpBipCube<unsigned short> &Cube, long LowerLeftRow=0,long LowerLeftColumn=0,
  28. long UpperRightRow=-1,long UpperRightColumn=-1,long LowerBand=0,long UpperBand=-1)
  29. { LoadAnyCube(Cube,LowerLeftRow,LowerLeftColumn,UpperRightRow,UpperRightColumn,LowerBand,UpperBand); }
  30.  
  31. template<class T>
  32. void LoadAnyCube(UtpBipCube<T> &Cube, long LowerLeftRow=0,long LowerLeftColumn=0,
  33. long UpperRightRow=-1,long UpperRightColumn=-1,long LowerBand=0,long UpperBand=-1);
  34.  
  35. #include <iostream>
  36. #include <string>
  37.  
  38. using namespace std;
  39.  
  40. template <typename T>
  41. class A{
  42. public:
  43. virtual void func1(const T& p)
  44. {
  45. cout<<"A:"<<p<<endl;
  46. }
  47. };
  48.  
  49. template <typename T>
  50. class B
  51. : public A<T>
  52. {
  53. public:
  54. virtual void func1(const T& p)
  55. {
  56. cout<<"A<--B:"<<p<<endl;
  57. }
  58. };
  59.  
  60. int main(int argc, char** argv)
  61. {
  62. A<string> a;
  63. B<int> b;
  64. B<string> c;
  65.  
  66. A<string>* p = &a;
  67. p->func1("A<string> a");
  68. p = dynamic_cast<A<string>*>(&c);
  69. p->func1("B<string> c");
  70. B<int>* q = &b;
  71. q->func1(3);
  72. }
  73.  
  74. A:A<string> a
  75. A<--B:B<string> c
  76. A<--B:3
  77.  
  78. class X
  79. {
  80. public:
  81. template <typename T>
  82. virtual void func2(const T& p)
  83. {
  84. cout<<"C:"<<p<<endl;
  85. }
  86. };
  87.  
  88. X x;
  89. x.func2<string>("X x");
  90.  
  91. vtempl.cpp:34: error: invalid use of `virtual' in template declaration of `virtu
  92. al void X::func2(const T&)'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement