I am trying to use the disphanddealer in Player.cpp, but it is saying that it is not declared. I thought that since I put "friend class Dealer" into player.h, I would be able to use the functions in dealer.h? Am I wrong?
I am getting an error on line 75 of player.cpp ("disphanddealer was not declared in this scope")
Also, if anyone can tell me, sometimes when I run it, the dealer displays a random character (like a music note, or an alpha) rather than a number(or J, Q, K, or A). Does anyone know why this is?
class B
{
// B declares A as a friend...
friendclass A;
private:
void xyz()
{
std::cout << "in B's xyz";
}
};
class A
{
public:
A()
{
B b;
// ... and A now has access to B's private members
b.xyz();
}
};
int main()
{
A a;
return 0;
}
You need to call disphanddealer() with a dealer object. You're just trying to call it as if it were a global function.
You are getting weird characters displayed because the ASCII characters between 11 and 13 are not printable, and you are trying to display them by casting those numbers to characters.