public class Card
{
private Rank aRank;
private Suit aSuit;
public Card( Card pCard )
{
aRank = pCard.aRank;
aCard = pCard.aSuit;
}
...
I'm a bit confused. The references happen between members of the same class, but I thought the only way you can access the private variable without getters is that it references the private variable within the method of the same class, and it has to be within the caller's scope(If that makes sense? Meaning we can only access the caller's instance variables). But in this case, pCard is not the caller of the constructor; it's just an another object that is passed as a parameter. So I was expecting something like:
public class Card
{
private Rank aRank;
private Suit aSuit;
public Card( Card pCard )
{
aRank = pCard.get_aRank();
aCard = pCard.get_aSuit();
}
...