tags:

views:

181

answers:

3

Hello, I am writing a class. I have encountered the problem in the title. Here is the code:

class delivery
{
    private string strDeliveryName;
    private string strDeliveryAddress;
    private string strDeliveryDay;
    private string strDeliveryTime;
    private string strDeliveryMeal;
    private string strDeliveryInstructions;
    private string strDeliveryStatus;
}
public delivery(string deliveryName, string deliveryAddress, string deliveryDay, string deliveryTime, string deliveryMeal, string deliveryInstructions, string deliveryStatus)
    {
        strDeliveryName = deliveryName;
        strDeliveryAddress = deliveryAddress;
        strDeliveryDay = deliveryDay;
        strDeliveryTime = deliveryTime;
        strDeliveryMeal = deliveryMeal;
        strDeliveryInstructions = deliveryInstructions;
        strDeliveryStatus = deliveryStatus;
    }

I get the error on the public delivery, any idea why?

+7  A: 

Your constructor should be within the brackets of the class definition. On an unrelated note, the convention is to capitalize the first letter of class names.

unholysampler
Fixed, thanks.I understand about the class names and will update accordingly
Luke
Remember to accept the answer that solved your problem. It gives people credit for the work they did. Also, if you have a low acceptance rate, some people will be less likely to answer your questions.
unholysampler
+1  A: 

Your constructor code is not inside the class. Move it inside and all should be fine. :-)

Enigmativity
Again thanks, once I capitalized, it didn't work!
Luke
Is it working now? If not, please edit your question and show us your code.
SLaks
It's working fine! Thanks
Luke
+1  A: 

To answer your second question (in the comment), you need to change the name of the constructor to match the name of the class.

SLaks