1 Replies - 367 Views - Last Post: 10 March 2012 - 12:57 PM Rate Topic: -----

#1 NolanHodge   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 10-March 12

How to I call a method from a different class into another? (C#)

Posted 10 March 2012 - 12:51 PM

I want to bring the methods like GetArea and GetArea and GetCircumference into my CircleFinal Class. Please help!

using System;



    public class CircleFinal: CircleStatistics
    {
        
            public static void Main()
            {
                CircleStatistics Final1 = new CircleStatistics();
                Final1.GetRadius; 


            



                

            }

        }


 


 using System;





    public class CircleStatistics
    {
        
        public double Radius;
        const double PI = 3.14159;
        double Area;
        double Circumference;
        



        public double Circle()
        {
            
            Area = PI * (Radius * Radius);
            Circumference = 2 * PI * Radius; 


            return 0;
        }

    
      
        public double Circle(double Rad)
        {


            GetRadius(Rad);
            Console.WriteLine("The Radius is the Circle is {0}", Radius);
            GetArea(Rad);
            GetCircumference(Rad);

            return 0;

        }
       

        public void SetRadius(double Rad)
        {
           double Radius = Rad;

        }

        public double GetRadius(double Rad)
        {
            Console.Write("What is the Radius of the Circle?");
            Rad = double.Parse(Console.ReadLine());

            return Radius;
        }

        public double GetArea(double Rad)
        {
            Console.WriteLine("The Area of the Circle Is: ");
            return PI * (Radius * Radius);
        }

        public double GetCircumference(double Rad)
        {
            Console.WriteLine("The Circumfernce of the Circle Is:");
            return 2 * PI * Radius;
        }

    }



Is This A Good Question/Topic? 0
  • +

Replies To: How to I call a method from a different class into another? (C#)

#2 tlhIn`toq   User is offline

  • Xamarin Cert. Dev.
  • member icon

Reputation: 6538
  • View blog
  • Posts: 14,450
  • Joined: 02-June 10

Re: How to I call a method from a different class into another? (C#)

Posted 10 March 2012 - 12:57 PM

Please don't open new threads for the same topics.
You already have a thread open for this.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1