I am trying to write a basic program, with two classes. I can manage fine with one class:
public static void Main (string[] args)
{
double radius;
double height;
double volume;
{
System.Console.WriteLine ("Enter radius");
radius = double.Parse(System.Console.ReadLine());
System.Console.WriteLine (radius);
System.Console.WriteLine ("Enter height");
height = double.Parse(System.Console.ReadLine());
System.Console.WriteLine (height);
volume = Math.PI * radius * radius * height;
System.Console.WriteLine (volume);
But I am unable to use ref from one class to another, for example, I tried removing the final volume calculation and making this seperate class:
class Calculation
{
double radius2 = 0.00;
double height2 = 0.00;
double volume2
radius2(ref radius);
height2(ref height);
volume2 = Math.PI * radius2 * radius2 * height2;
}
But it doesn't work at all. I'm quite new to C#, thanks for any help you can offer!