Hi guys, can some one help to see what is problem with below code. I am newbie to C#:
Thanks

=================================================================================

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

namespace Lesson4Inheritance2
{
    class Student
    {

       public static void Main(string[] args)
        {
       
            private int registrationNumber;
            private string name;
            private DateTime DateOfBirth;

            public Student()
            {
                Console.WriteLine("New Student created. Parameterless constructor called....");
            }
        }
    }
}

Your constructor and class fields are nested inside Main. It should look like this:

class Student
{
    private int registrationNumber;
    private string name;
    private DateTime DateOfBirth;

    public Student()
    {
        Console.WriteLine("New Student created. Parameterless constructor called....");
    }

    public static void Main(string[] args)
    {
    }
}

Thank you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.