using System;
public class Demo
{
public static void Main()
{
COBOLClass DerivedObject = new COBOLClass();
CSharpClass BaseReference = DerivedObject;
Console.WriteLine(BaseReference.Factorial(4));
Console.WriteLine("Done!");
}
}
Demo.cs:
public class CSharpClass
{
public virtual int Factorial (int x)
{
int value = 0;
for (int i = 1; i <= x; ++i)
value = value + i;
return value;
}
}
CSharpClass.cs:
Previous slide | Next slide | Back to first slide | View graphic version |