You must Sign In to post a response.
  • Category: .NET

    End of file expected error in a very simple program

    Hi

    I am started using .net programming languages and getting end of file error message when I execute the following simple inheritance program and could not find any errors

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

    namespace cscodes
    {
    class Program
    {
    static void Main(string[] args)
    {
    void shape ()
    {
    Console.WriteLine("Buildingshape is square");
    }
    }
    }
    class child : Program
    {
    void func()
    {
    child c = new child();
    c.shape();
    }
    }
    }
  • #765818
    when any curly braces is removed or added extra then application throws such message check for below snippet and see if it works for you

    namespace cscodes
    {
    class Program
    {
    static void Main(string[] args)
    {
    void shape ()
    {
    Console.WriteLine("Buildingshape is square");
    }
    }
    }
    class child : Program
    {
    void func()
    {
    child c = new child();
    c.shape();
    }
    }
    }

    Thanks
    Koolprasd2003
    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #765821
    Thank you Prasad, I had add an another file in my project and that was the issue.


Sign In to post your comments