Beispiel #1
0
        static void Main(string[] args)
        {
            Triangle t1 = new Triangle(4.0,4.0,"isosceles");
            Triangle t2 = new Triangle(8.0,12.0,"right");
            Triangle t3 = new Triangle(t2);

            Console.WriteLine("info for t1: ");
            t1.showStyle();
            t1.showDim();
            Console.WriteLine("area is " + t1.area());

            Console.WriteLine();
            Console.WriteLine("info for t2: ");
            t2.showStyle();
            t2.showDim();
            Console.WriteLine("area is " + t2.area());

            Console.WriteLine();
            Console.WriteLine("info for t3: ");
            t3.showStyle();
            t3.showDim();
            Console.WriteLine("area is " + t3.area());


        }
Beispiel #2
0
 // copy constructor, c# style.
 public Triangle(Triangle obj)
     : base(obj)
 {
     m_style = obj.m_style;
 }