Click here to Skip to main content
15,890,609 members
Home / Discussions / C#
   

C#

 
QuestionCREATE DATABASE permission denied in database 'master' Pin
haleemasher23-Dec-09 19:39
haleemasher23-Dec-09 19:39 
AnswerRe: CREATE DATABASE permission denied in database 'master' Pin
Russ-T23-Dec-09 20:24
Russ-T23-Dec-09 20:24 
Questiondraw rich text in a custom control Pin
Duong Tien Nam23-Dec-09 16:11
Duong Tien Nam23-Dec-09 16:11 
AnswerRe: draw rich text in a custom control Pin
Jimmanuel24-Dec-09 2:25
Jimmanuel24-Dec-09 2:25 
QuestionC# TripleDES and Perl CPAN:Crypt Pin
draskosaric23-Dec-09 15:28
draskosaric23-Dec-09 15:28 
AnswerRe: C# TripleDES and Perl CPAN:Crypt Pin
Garth J Lancaster23-Dec-09 17:01
professionalGarth J Lancaster23-Dec-09 17:01 
GeneralRe: C# TripleDES and Perl CPAN:Crypt Pin
draskosaric24-Dec-09 20:59
draskosaric24-Dec-09 20:59 
QuestionC# Creating a class and assigning properties to it. Pin
Darrall23-Dec-09 14:01
Darrall23-Dec-09 14:01 
I am just starting to learn C# so my question will likely seem stupid to most people looking at this. I am just getting to the part about creating classes and turning them in to objects. My questions have to do with the following code.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace circle
{
    class circle
    {        
        int center_x;
        int center_y;
        double Radius;
        
        public int x
        {
            get { return center_x;}
            set { center_x = value;}
        }
        public int y
        {
            get { return center_y;}
            set { center_y = value;}
        }
        public double radius
        {
            get { return Radius;}
            set { Radius = value;}
        }
    
        
    }
    class MyApp
    {
        public static void Main()
        {
            circle myCircle = new circle();
            myCircle.x = 10;
            myCircle.y = 10;
            myCircle.radius = 8;

            Console.WriteLine("Center: = {0},{1}", myCircle.x, myCircle.y);
            Console.WriteLine("Radius: = {0}", myCircle.radius);
            Console.WriteLine("Circumference: = {0}", (double)(2 * Math.PI * myCircle.radius));
            
        }
    }
}


My first question is with the variable Radius why is it that where it is declared as public double radius followed by the properties that you have to use a small r when all the other instances of Radius use a cap?

When you use a cap R it returns the error message "ambiguity between circle.circle.Radius and circle.circle.Radius"

How do you compare two things exactly the same?

Also why is this rule not true for the x and the y?

My other question (the big one) is what does any of the code down to class MyApp have to do with the code in class MyApp?

Obviously I'm not going to get far in C# if I can't understand the most important part of it.

Thanks for any help anyone can give me.
AnswerRe: C# Creating a class and assigning properties to it. Pin
Luc Pattyn23-Dec-09 15:00
sitebuilderLuc Pattyn23-Dec-09 15:00 
GeneralRe: C# Creating a class and assigning properties to it. Pin
Darrall23-Dec-09 15:49
Darrall23-Dec-09 15:49 
GeneralRe: C# Creating a class and assigning properties to it. Pin
Luc Pattyn23-Dec-09 16:06
sitebuilderLuc Pattyn23-Dec-09 16:06 
GeneralRe: C# Creating a class and assigning properties to it. Pin
Darrall24-Dec-09 4:26
Darrall24-Dec-09 4:26 
AnswerRe: C# Creating a class and assigning properties to it. Pin
#realJSOP23-Dec-09 21:56
mve#realJSOP23-Dec-09 21:56 
GeneralRe: C# Creating a class and assigning properties to it. Pin
Darrall24-Dec-09 4:52
Darrall24-Dec-09 4:52 
AnswerRe: C# Creating a class and assigning properties to it. Pin
Richard MacCutchan23-Dec-09 22:28
mveRichard MacCutchan23-Dec-09 22:28 
GeneralRe: C# Creating a class and assigning properties to it. Pin
Darrall24-Dec-09 4:59
Darrall24-Dec-09 4:59 
AnswerRe: C# Creating a class and assigning properties to it. Pin
hamed-vojdani24-Dec-09 5:27
hamed-vojdani24-Dec-09 5:27 
GeneralRe: C# Creating a class and assigning properties to it. Pin
Darrall24-Dec-09 5:39
Darrall24-Dec-09 5:39 
QuestionCondense a list Pin
o m n i23-Dec-09 11:57
o m n i23-Dec-09 11:57 
AnswerRe: Condense a list Pin
Luc Pattyn23-Dec-09 12:07
sitebuilderLuc Pattyn23-Dec-09 12:07 
GeneralRe: Condense a list Pin
o m n i23-Dec-09 12:32
o m n i23-Dec-09 12:32 
QuestionGeneral issue: When application doesn't have focus, and you click a button on it, it doesn't register.... Pin
sherifffruitfly23-Dec-09 11:03
sherifffruitfly23-Dec-09 11:03 
AnswerRe: General issue: When application doesn't have focus, and you click a button on it, it doesn't register.... Pin
Ravi Bhavnani23-Dec-09 14:01
professionalRavi Bhavnani23-Dec-09 14:01 
QuestionReflection Get Access Modifier Pin
dataminers23-Dec-09 9:02
dataminers23-Dec-09 9:02 
AnswerRe: Reflection Get Access Modifier Pin
Luc Pattyn23-Dec-09 9:45
sitebuilderLuc Pattyn23-Dec-09 9:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.