W
William Payne
Hello, I was under the impression that if I made a class Foo and if I didn't
specify a copy constructor I would get one anyway that simply assigns the
member variables (and that won't work for dynamically allocated member
variables). Anyway, I have a program that segfaults without a copy
constructor but if I add an empty one, the segfault is gone. The code is
ugly indeed so I don't want to post it, but, in general terms, what sort of
error could I be avoiding when I define my own empty copy constructor
instead of using the one the compiler would generate for me if I had none?
The class doesn't allocate any memory dynamically itself.
/ WP
specify a copy constructor I would get one anyway that simply assigns the
member variables (and that won't work for dynamically allocated member
variables). Anyway, I have a program that segfaults without a copy
constructor but if I add an empty one, the segfault is gone. The code is
ugly indeed so I don't want to post it, but, in general terms, what sort of
error could I be avoiding when I define my own empty copy constructor
instead of using the one the compiler would generate for me if I had none?
The class doesn't allocate any memory dynamically itself.
/ WP