• 1405/03/09

تمرین جلسه 68 interface :

سلام وقتتون بخیر تمرین جلسه 68 ام

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

namespace ConsoleApp11
{
    internal class daneshjo : student
    {
        public int age(int age)
        {
            if (age > 18)
            {
                return  age;
            }
            else { throw new Exception("sen kamter az had mojaz"); }
        }

        public string esm(string name, string family)
        {
            return$"esm danshjo { name} { family}";
        }

        public string reshteh(string reshteh)
        {
            return reshteh;
        }

        public int shahrieh(int shahrieh)
        {
            shahrieh = 0;
            return shahrieh;
        }

        public int stid(int stid)
        {
            return stid;    
        }

      
    }
}

namespace ConsoleApp11
{
    internal interface student
    {
        int age(int age);
        int stid(int stid);
        String reshteh(string reshteh);
        int shahrieh(int shahrieh);
        string esm(string name, string family);

    }
}

using ConsoleApp11;

daneshjo daneshjo = new daneshjo();
int resalt=daneshjo.age(19);
Console.WriteLine($"sen danshojo{ resalt}");
string resalt2=daneshjo.esm("shayan", "hozhabry");
Console.WriteLine( resalt2);
string resalt3=daneshjo.reshteh("mohandesy computer");
Console.WriteLine($"rashe daneshjo {resalt3}");
int resalt4 = daneshjo.stid(402225260);
Console.WriteLine($"shomare daneshjo {resalt4}");