[ create a new paste ] login | about

Link: http://codepad.org/MO5ZbV3J    [ raw code | output | fork ]

C++, pasted on Jan 16:
#include <iostream>
using namespace std;

class Tree
{
  public:
  ~Tree(){
    delete branches_;
  }
  Tree(int branchCount = 0){
        branchCount_ = branchCount;
        if( branchCount_ != 0 )
        branches_    = new Tree[branchCount_];
        else
        branches_    = 0;
  }
  void Resize(int newsize){
    //взагалі все виглядає десь так
    Tree *newbranches_ = 0;
    if( newsize )
    {
        newbranches_ = new Tree [newsize];
        for( int i = 0; i < newsize; i++ )
        {
            if( i < branchCount_ )
              newbranches_ [i] =  branches_[i];//ви гадаєтеце буде просто?
        }
    }
    delete branches_;
    branches_    = newbranches_ ;
    branchCount_ = newsize;
  }
private:
  int branchCount_;
  Tree *branches_;
};


Output:
1
2
In function `_start':
undefined reference to `main'


Create a new paste based on this one


Comments: