Click here to Skip to main content
15,891,204 members
Home / Discussions / C#
   

C#

 
GeneralRe: thanks but.. Pin
leppie13-Jul-03 10:53
leppie13-Jul-03 10:53 
GeneralGraphics.DrawCurve() question Pin
Meysam Mahfouzi11-Jul-03 20:19
Meysam Mahfouzi11-Jul-03 20:19 
GeneralRe: Graphics.DrawCurve() question Pin
peterchen13-Jul-03 8:37
peterchen13-Jul-03 8:37 
GeneralRe: Graphics.DrawCurve() question Pin
Meysam Mahfouzi13-Jul-03 19:18
Meysam Mahfouzi13-Jul-03 19:18 
General2 not so # things Pin
leppie11-Jul-03 16:39
leppie11-Jul-03 16:39 
GeneralRe: 2 not so # things Pin
James T. Johnson11-Jul-03 17:32
James T. Johnson11-Jul-03 17:32 
GeneralRe: 2 not so # things Pin
leppie11-Jul-03 18:11
leppie11-Jul-03 18:11 
GeneralRe: 2 not so # things Pin
Nick Parker11-Jul-03 18:30
protectorNick Parker11-Jul-03 18:30 
leppie wrote:
An abstract class may not be constructed, so why do you need to provide a constructor?

It really isn't required, in fact this compiled fine for me (and worked) when I commented out the constructor:

abstract class CreditCard
{
    //private CreditCard(){}


    //*************************************************
    //  Input:    string representing a credit card
    //        number.
    //
    //  Returns:  true if a valid credit card number
    //            false if not
    //*************************************************
    public static bool Validate(string CreditCardNumber)
    {
        int sum = 0;

        for(int i = 0; i < CreditCardNumber.Length; i++)
        {   // odd number here
            if((int)CreditCardNumber[i]%2 != 0)
            {
                if((int)CreditCardNumber[i] * 2 > 9)
                    sum += ((int)CreditCardNumber[i] * 2) - 9;
                else
                    sum += (int)CreditCardNumber[i] * 2;
            }
            else    // even number here
            {
                if((int)CreditCardNumber[i] != 0)
                    sum += (int)CreditCardNumber[i];
            }
        }

        return(Convert.ToBoolean(sum%10));
    }

}


-Nick Parker
GeneralRe: 2 not so # things Pin
leppie11-Jul-03 18:45
leppie11-Jul-03 18:45 
GeneralRe: 2 not so # things Pin
Nick Parker12-Jul-03 5:26
protectorNick Parker12-Jul-03 5:26 
GeneralRe: 2 not so # things Pin
Heath Stewart11-Jul-03 18:31
protectorHeath Stewart11-Jul-03 18:31 
GeneralRe: 2 not so # things Pin
leppie11-Jul-03 19:29
leppie11-Jul-03 19:29 
GeneralRe: 2 not so # things Pin
Heath Stewart12-Jul-03 0:41
protectorHeath Stewart12-Jul-03 0:41 
GeneralRe: 2 not so # things Pin
James T. Johnson11-Jul-03 18:57
James T. Johnson11-Jul-03 18:57 
GeneralRe: 2 not so # things Pin
Heath Stewart11-Jul-03 18:21
protectorHeath Stewart11-Jul-03 18:21 
GeneralRe: 2 not so # things Pin
leppie11-Jul-03 18:29
leppie11-Jul-03 18:29 
GeneralOK, slap me silly and call me Susan - NOT Pin
leppie11-Jul-03 18:49
leppie11-Jul-03 18:49 
GeneralRe: 2 not so # things Pin
leppie11-Jul-03 19:40
leppie11-Jul-03 19:40 
GeneralRe: 2 not so # things Pin
Heath Stewart12-Jul-03 0:15
protectorHeath Stewart12-Jul-03 0:15 
GeneralRe: 2 not so # things Pin
leppie12-Jul-03 1:54
leppie12-Jul-03 1:54 
GeneralTooltips Pin
Nnamdi Onyeyiri11-Jul-03 12:25
Nnamdi Onyeyiri11-Jul-03 12:25 
GeneralRe: Tooltips Pin
Nick Parker11-Jul-03 18:33
protectorNick Parker11-Jul-03 18:33 
GeneralRe: Tooltips Pin
Nnamdi Onyeyiri11-Jul-03 23:27
Nnamdi Onyeyiri11-Jul-03 23:27 
GeneralServer Certificates Pin
Jeff Phillips11-Jul-03 8:36
Jeff Phillips11-Jul-03 8:36 
GeneralRe: Server Certificates Pin
Heath Stewart11-Jul-03 8:46
protectorHeath Stewart11-Jul-03 8:46 

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.