Przykład dziedziczenia 2
Jak w opisie.
Kompilator: Microsoft Visual Studio
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Test
{
class Klasa3
{
public int Metoda1(int x)
{
return 10 * x;
}
public double Metoda1(double x)
{
return 20 * x;
}
}
class Program
{
static void Main(string[] args)
{
int a;
double b;
Klasa3 prz = new Klasa3();
a = prz.Metoda1(10);
b = prz.Metoda1(3.14);
Console.WriteLine("a wynosi: " + a);
Console.WriteLine("b wynosi: " + b);
Console.ReadKey();
}
}
}