S
Serdar C
hi everyone.. i have a problem that i couldnt find the answer through the
web..
maybe i am asking the wrong question.. but here comes my problem..
----------------------------------
using System;
namespace NeuralNetwork
{
public class SCNeuralNetwork
{
private double activation;
private double treshold;
public SCNeuralNetwork()
{
Random random = new Random();
activation = random.NextDouble();
treshold = random.NextDouble();
}
public SCNeuralNetwork(double act,double tre)
{
this.Activation = act;
this.Treshold = tre;
}
public double Activation
{
set{activation = value;}
get{return activation;}
}
public double Treshold
{
set{treshold = value;}
get{return treshold;}
}
}
}
everything works good but when i try the call my class from main program
like this:
mainprogram.SCNeuralnetwork []network = new mainprogram.SCNeuralnetwork[10];
network[0].Activation = 10;
when i try to do something like this program throws "Object reference not
set to an instance of an object." exception.
what am i doing wrong? i cant set or read the values from the aray of
classes..
p.s: it works fine when i create the classs like ;
mainprogram.SCNeuralnetwork network = new mainprogram.SCNeuralnetwork();
thanks for helping and spending your time.. have a nice day..
web..
maybe i am asking the wrong question.. but here comes my problem..
----------------------------------
using System;
namespace NeuralNetwork
{
public class SCNeuralNetwork
{
private double activation;
private double treshold;
public SCNeuralNetwork()
{
Random random = new Random();
activation = random.NextDouble();
treshold = random.NextDouble();
}
public SCNeuralNetwork(double act,double tre)
{
this.Activation = act;
this.Treshold = tre;
}
public double Activation
{
set{activation = value;}
get{return activation;}
}
public double Treshold
{
set{treshold = value;}
get{return treshold;}
}
}
}
everything works good but when i try the call my class from main program
like this:
mainprogram.SCNeuralnetwork []network = new mainprogram.SCNeuralnetwork[10];
network[0].Activation = 10;
when i try to do something like this program throws "Object reference not
set to an instance of an object." exception.
what am i doing wrong? i cant set or read the values from the aray of
classes..
p.s: it works fine when i create the classs like ;
mainprogram.SCNeuralnetwork network = new mainprogram.SCNeuralnetwork();
thanks for helping and spending your time.. have a nice day..