Created
          June 28, 2014 11:37 
        
      - 
      
 - 
        
Save amkatrutsa/232593762e00fa82895f to your computer and use it in GitHub Desktop.  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | class MyVector { | |
| int* vector; | |
| int size; | |
| public: | |
| MyVector() : vector(new int[1]), size(1) { } | |
| MyVector(int size) { | |
| vector = new int[size]; | |
| this->size = size; | |
| } | |
| MyVector(int size, int num) { | |
| vector = new int[size]; | |
| this->size = size; | |
| for (int i = 0; i < size; i++) | |
| vector[i] = num; | |
| } | |
| void push(int num); | |
| void pop(); | |
| int getsize(); | |
| int operator [] (int index) const { | |
| return this->vector[index]; | |
| } | |
| ~MyVector() { delete[] vector; delete &size; } | |
| }; | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment