Get rid of the pointers for great good™. And while we’re at it, move as much as you can to the constructor.
AnotherClass classB::setupData()
{
AnotherClass a(/* setup data */);
return a;
}
Should get yourself rid of more than one problem at once.
More Related Contents:
- Why the loop becomes infinite? [closed]
- Getting Segmentation fault for implementing ByteSize() in C++ for protobuffer
- How to make threads write their numbers in reverse order using OpenMP?
- Why is my C++ program only printing one character?
- Start thread with member function
- Significance of -pthread flag when compiling
- Difference between static and shared libraries?
- Does the default constructor initialize built-in types?
- Looking for C++ STL-like vector class but using stack storage
- Why is a boolean 1 byte and not 1 bit of size?
- How to map the indexes of a matrix to a 1-dimensional array (C++)?
- How to reset std::cin when using it?
- Is reading an indeterminate value undefined behavior?
- C/C++ changing the value of a const
- Function-to-function-pointer “decay”
- Finding nearest point in an efficient way
- Windows Unicode C++ Stream Output Failure
- TCP/IP connection on a specific interface
- What does “void *(*)(void *)” mean in C++?
- I want to generate the nth term of the sequence 1,3,8,22,60 ,164 in Order(1) or order of (nlogn)
- Variable length arrays (VLA) in C and C++
- Logical AND, OR: Is left-to-right evaluation guaranteed?
- Are there gotchas using varargs with reference parameters
- malloc() vs. HeapAlloc()
- Converting between C++ std::vector and C array without copying
- C++ Template Metaprogramming – Is it possible to output the generated code?
- Why do some people prefer “T const&” over “const T&”?
- c++11 Thread class how to use a class member function
- Iterating through a Lua table from C++?
- Why is operator!= removed in C++20 for many standard library types?