copy constructors; use new[] instead of malloc