|
|
Re: Problem with loading TVector3 in R3BRoot [message #23200 is a reply to message #23199] |
Wed, 31 October 2018 10:21 |
Jan Mayer
Messages: 20 Registered: August 2015
|
occasional visitor |
From: *ikp.uni-koeln.de
|
|
I would also like to add the following:
You should not use a pointer for a member that the class owns (= is responsible for), with few exceptions.
Here, R3BTest class can simply own it naturally, like the TString one line above. Just think simple. No need to initialize and delete it, nothing can go wrong, the code is much shorter and easier to understand.
If the class needs to own a polymorphic class, there are unique and shared ptrs.
A class may include pointer members to stuff it is not responsible for.
See also https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#S-resource
|
|
|