Saturday, October 31, 2015

C# what is a class

C# has got too much going on and you do forget whats a class, or object, or method or function...so what were we learning, yes the "class".

Let me put it as simply as possible.


Even after that mall example you didn't get it, you a thick head, follow the example below:

Lets take a look at our SimpleCalculator Example;

The class code;

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

namespace ConsoleApplication1
{
    class SimpleCalculator
    {

        public int add(int x, int y)
        {
            Console.Write("\nThe addition is ");
            return x + y;

        }


        public int mul(int x, int y)
        {
            Console.Write("\nThe multiplication is ");
            return x * y;

        }
    }
}
Have a look at the image below in fullscreen to know what is what.


No comments:

Post a Comment