Results 1 to 2 of 2

Thread: Exception class

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2005
    Location
    wisconsin
    Posts
    4

    Exception class

    I'm a newbie to C# I have a question about an exception class. I need to create a exception class called CandyBarException whose constructor receives a string that consists of a candy bar flavor and number of bars. Would this be correct:

    public class CandyBarException : ApplicationException
    {
    private static string msg = "Please pick a different Flavor.";
    private static int msg = " You cannot pick more than 3.";
    public CandyBarException(string name, int bar)
    {
    }
    }
    I don't know if this matters but it is a console program

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Exception class

    You have two variables named msg and you're assigning a string to an int variable.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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