Quantcast
Channel: User HolyBlackCat - Stack Overflow
Viewing all articles
Browse latest Browse all 1351

Comment by HolyBlackCat on How can i use class objects as parameters in other classes?

$
0
0
First, you have to get rid of the circular includes (look it up), probably by removing both and replacing them with foward declarations. Second, every function parameter where you accept a vector/matrix by value, you should probably accept by a const reference instead. Third, unless your goal is to practice manual memory management, get rid of the raw pointers and new/malloc calls, and use std::vector or std::unique_ptr instead. (Or, if you do want to practice doing it manually, you must write destructors and copy/move constructors/assignments, otherwise your code is leaking memory).

Viewing all articles
Browse latest Browse all 1351


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>