I'm not sure if I'm asking that correctly, so bear with me. I'm currently attempting to program a neural network. Below is some sample code.
using System;
namespace Network
{
class BaseNeuron
{
public static void Main (string[] args)
{
public int Weight;
public void sendPulse()
{
}
public void receivePulse()
{
}
}
}
}
So basically, I want to be able to create multiple instances of the BaseNeuron class, with each "neuron" tied to other "neurons" to make a Neuron Network. Is there any way to do this without having to reiterate this snippet of code for each neuron?
First of all, there are some errors in the code you provided:
It should be:
Notice that the
Main
is gone. Classes normally don't have aMain
method, which is usually just the entry point of the application (the first function to get executed when the program runs).Basically, each class is a template for objects, which means you can create new instances of the class by using the
new
keyword, like this:I suggest you read a little bit about class (maybe here) to get a better understanding how this works.
Alright, so now we have our class figured out. You said we wanted to make a network which consists of several neurons, which are instances of the class above. So, what you will probably want to do is:
Of course, the implementation depends of the internal implementation of the
BaseNeuron
class. You also might need to create aNeuralNetwork
class to contain the above code and related functions.