Dear all,
I'm starting to get the hang of this C++ business, but I have one question that I just realized I don't have an answer to. Suppose I want to call a constructor from within a constructor to reduce redundancy in the parts that are identical. I seem to have trouble doing this. I can't find any way to do it to the right after a ':' that compiles, and if I call it directly within the constructor, I get a crash when I run the program. I have found a work around which is to call a separate function that is an initialization function from within the constructors, but I'd like to know whether there is a way to do it with constructors themselves or if that idea is simply wrong or not the way C++ was intended to be organized.
Thanks,
Sean
smcguffee 0 Newbie Poster
amrith92 119 Junior Poster
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster
smcguffee 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.