All pastes #607509 Raw Edit

Miscellany

public cpp v1 · immutable
·published 2007-07-07 17:30 UTC
rendered paste body
struct Item{    char* Link;    Item(char*link);    Item(const Item&);    ~Item();}//2 different constructors!#include <string>//when this one is called, i must destroy Link with delete []Link;Item::Item(char*link,unsigned depth):Link(link){}//when this one is called, i must free Link with free(Link);Item::Item(const Item& src):Link(strdup(src.Link)){}//so how should desctructor look like?Item::~Item(){    free(Link);    delete Link;}/*is it okey to leave    free(Link);    delete Link;or i should do something with try{}catch(){} block?*/