blob: f8007d1e7045ede11987eb3662fd05ff473133cb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
public class Padre
{
private double _x = 10;
public virtual void Incrementa(double a)
{
_x = _x + a;
}
public void print() { Console.WriteLine(_x); }
}
public class Hijo : Padre
{
public override void Incrementa(double a)
{
double b = a + (a * 0.1);
Console.WriteLine(b);
base.Incrementa(b);
}
}
internal class Test
{
public static int Main()
{
Hijo h = new Hijo();
h.Incrementa(1.0);
h.print();
return 100;
}
}
|