How to call a method from another class in c#

1 Answer

0 votes
using System;

namespace ConsoleApplication1
{
    public class AClass
    {
        public void afunction()
        {
            Console.WriteLine("afunction");
        }
    }
    class Program
    {
        static void Main(string[] args)
        {
            AClass obj = new AClass();

            obj.afunction();
        }
    }
}

/*
run:
   
afunction
      
*/

 



answered Apr 22, 2017 by avibootz

Related questions

1 answer 150 views
1 answer 165 views
1 answer 230 views
1 answer 200 views
1 answer 220 views
...