Just a quick question about how to convert a certain line of code between c++ and Java. I've been learning about Neural Networks and I've been starting to write my own in the language I have the most experience with, Java. It's been pretty straightforward to translate the code from C++ to Java so far, however there's one little issue I've ran into. I'm puzzled by how to translate this specific line of code into a Java equivalent, and I can't find anything specific to this issue through searching.
The original code is:
Struct SNeuron {
//the number of inputs into the neuron
int m_NumInputs;
//the weights for each input
vector<double> m_vecWeight;
//ctor
SNeuron(int NumInputs);
};
and my code is:
public class SNeuron {
public int m_NumInputs; // the number of inputs into the neuron
public ArrayList<Double> m_vecWeight = new ArrayList<Double>(); // the weights for each input
// ctor
My question is, how do I convert:
SNeuron(int NumInputs);
into its Java equivalent? From what i've read, Structs don't seem to be a feature Java uses, so i'm just struggling a bit to understand what exactly that line of code actually does in the context it's used.
public class SNeuron
{
// the number of inputs into the neuron
public int m_NumInputs;
// the weights for each input
public List<Double> m_vecWeight = new ArrayList<Double>();
// ctor
SNeuron(int NumInputs) {
m_NumInputs = NumInputs;
}