Simple2012

Untitled

Oct 20th, 2013
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include "circle.h"
  2. #include "shape.h"
  3. #include <vector>
  4.  
  5. void GetData(std::vector<shape *> v, size_t size){
  6.     for(int i = 0; i < size ; i++)
  7.     {
  8.         ((circle*)v[i])->SetRadius(14);
  9.     }
  10. }
  11.  
  12.  
  13. int main(int argc, char const *argv[]){
  14.     std::vector<shape *> derivedClassHolder(1);
  15.     derivedClassHolder[0] = new circle;
  16.  
  17.     GetData(derivedClassHolder, derivedClassHolder.size());
  18.  
  19.     /*for(int i = 0; i < (int)derivedClassHolder.size() ; i++)
  20.     {
  21.         ((circle*)derivedClassHolder[i])->SetRadius(14);
  22.     }*/
  23. }
Advertisement
Add Comment
Please, Sign In to add comment