Class to Another Class Instantiation: Java to C++ Conversion
<p>Everyone, I need help in converting some codes in Java to C++. How can I instantiate the class as a private type from Java to C++? Here is what I mean, I are some lines of codes:</p>

<p>First Problem: Solved.</p>

<p>Second Problem: This java code is the one I wanted to convert, what do you think are wrong in my codes?</p>

<p>Original Code in Java:</p>

<pre><code>public class ClueReasoner 
{
private int numPlayers;
private int playerNum;
private int numCards;
private SATSolver solver;    
private String caseFile = "cf";
private String[] players = {"sc", "mu", "wh", "gr", "pe", "pl"};
private String[] suspects = {"mu", "pl", "gr", "pe", "sc", "wh"};
private String[] weapons = {"kn", "ca", "re", "ro", "pi", "wr"};
private String[] rooms = {"ha", "lo", "di", "ki", "ba", "co", "bi", "li", "st"};
private String[] cards;

public ClueReasoner()
{
    numPlayers = players.length;

    // Initialize card info
    cards = new String[suspects.length + weapons.length + rooms.length];
    int i = 0;
    for (String card : suspects)
        cards[i++] = card;
    for (String card : weapons)
        cards[i++] = card;
    for (String card : rooms)
        cards[i++] = card;
    numCards = i;

    // Initialize solver
    solver = new SATSolver();
    addInitialClauses();
}

private int getPlayerNum(String player) 
{
    if (player.equals(caseFile))
        return numPlayers;
    for (int i = 0; i &lt; numPlayers; i++)
        if (player.equals(players[i]))
            return i;
    System.out.println("Illegal player: " + player);
    return -1;
}

private int getCardNum(String card)
{
    for (int i = 0; i &lt; numCards; i++)
        if (card.equals(cards[i]))
            return i;
    System.out.println("Illegal card: " + card);
    return -1;
}

private int getPairNum(String player, String card) 
{
    return getPairNum(getPlayerNum(player), getCardNum(card));
}

private int getPairNum(int playerNum, int cardNum)
{
    return playerNum * numCards + cardNum + 1;
}    
</code></pre>

<p>My Code:</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;cstdlib&gt;
#include &lt;string&gt;

using namespace std;

void Scene_Reasoner() {
int numPlayer;
int playerNum;
int cardNum;
 string filecase = "Case: ";
 string players [] = {"sc", "mu", "wh", "gr", "pe", "pl"};
 string suspects [] = {"mu", "pl", "gr", "pe", "sc", "wh"};
string weapons []  = {"kn", "ca", "re", "ro", "pi", "wr"};
 string rooms[] = {"ha", "lo", "di", "ki", "ba", "co", "bi", "li", "st"};
 string cards [0];
};

void Scene_Reason_Base () {
    numPlayer = players.length;

    // Initialize card info
    cards = new String[suspects.length + weapons.length + rooms.length];
    int i = 0;
    for (String card : suspects)
        cards[i++] = card;
    for (String card : weapons)
        cards[i++] = card;
    for (String card : rooms)
        cards[i++] = card;
    cardNum = i;
    };

    private int getCardNum (string card) {
            for (int i = 0; i &lt; numCards; i++)
        if (card.equals(cards[i]))
            return i;
    cout &lt;&lt; "Illegal card: " + card &lt;&lt;endl;
    return -1;
    };

     private int getPairNum(String player, String card)
   {
    return getPairNum(getPlayerNum(player), getCardNum(card));
};

  private int getPairNum(int playerNum, int cardNum)
  {
    return playerNum * numCards + cardNum + 1;
};

int main () {
return 0;
}
</code></pre>
