c#Baseキーワードの使用
1598 ワード
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
class 1
{
//virtual ,
public virtual double Area(double a)
{
return a * 2;
}
}
class Test : 1
{
// Area, Area
public override double Area(double b)
{
// base.Area() Area
return base.Area(b) * 0.9;
}
}
class Result
{
static void Main()
{
Test TT = new Test();
Console.WriteLine(TT.Area(10));
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
class Class4
{
// 2
public Class4()
{
Console.WriteLine("Class4");
}
int i;
public Class4(int a)
{
i=a;
Console.WriteLine("Class:{0}", i);
}
public void SS()
{
Console.WriteLine("BOSS");
}
}
class Test:Class4
{
// ( )
public Test()
: base()
{
}
// ( )
public Test(int a)
: base(a)
{
base.SS();
}
}
class TT
{
static void Main()
{
Test T = new Test();
Test T1 = new Test(10);
}
}
}