Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Passing a vector through classes by ref ?

$
0
0
Hi, my name is Ricardo (I am gonna soon introduce myself properly in this forum). I am new to C++ and object oriented programming and having some sort of trouble working with "vectors".

My program has a class of "Accounts", a class of "Database", a class of "Adding" and some other classes that doesn´t matter right now - maybe in next questions :tt2: . My class Database extracts info from a ".txt" with each row of the file corresponding to an "Account" object and each column of each row corresponding to a data-member (I am brazilian and have know idea how to say that in English, they are kind of the properties of the object)- and so far so good. Then I put all the objects in a vector<Accounts>.

The problem is when I have to pass this vector to the Excluding class. I do that by reference. And here is the question: "By passing by ref, am I not hurting the principle of protecting the private data from the class ? " And: " is there any other way to do that without being by ref ? "

Thanks for everybody who helps.

Att,

Ricardo S.

Viewing all articles
Browse latest Browse all 51036

Trending Articles



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