Results 1 to 2 of 2

Thread: Creating Classes (RESOLVED)

Threaded View

  1. #1

    Thread Starter
    Lively Member JAtkinson's Avatar
    Join Date
    Feb 2004
    Location
    Richmond, VA
    Posts
    68

    Creating Classes (RESOLVED)

    Why does VS.net let you use System.Math.Abs(double) without creating a new instance of it (System.Math math = new System.Math)? Ive been trying to make my own class that will find the area of circle, but it makes me create a new object first (ADGMathPro.Circle circle = new ADGMathPro.Circle();

    What I was it to be able to do this....

    ADGMathPro.Circle.Area(34);
    instead of
    circle.Area(34);

    VB Code:
    1. namespace ADGMathPro
    2. {
    3.    /// <summary>
    4.    /// Summary description for Circle.
    5.    /// </summary>
    6.  
    7. public class Circle
    8.      {
    9.        
    10. const double pi = System.Math.PI;
    11.  
    12. public double Area(double radius)
    13.     {
    14.         double area;
    15.         area  = pi * (radius * radius);
    16.         return area;
    17.     }
    18.  
    19. public double Circumference(double radius)
    20.     {
    21.         double circumference;
    22.         circumference = 2 * pi * radius;
    23.         return circumference;
    24.     }
    25.  
    26. }
    27. }

    What am I doing wrong??

    Thanks
    Last edited by JAtkinson; May 9th, 2004 at 01:26 AM.
    Visual Studio .net 2003 EA
    VB .net
    C#

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width