如何实现将由student类实现的接口类

如何实现将由student类实现的接口类

本文介绍了如何实现将由student类实现的接口类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个名为IStudentGrade的接口类,它获取学生姓名并计算学生成绩。我还创建了一个继承Person类的Student类,并实现了接口IStudentGrade类。我将如何从学生班实施IStudentGrade课程?



我尝试过的方法:



I created an interface class called IStudentGrade that gets the student name and calculate the students grade. I also created a Student class that inherits Person class and implements the interface IStudentGrade class. How will I Implement IStudentGrade class from Student Class?

What I have tried:

namespace sample3
{
    interface IStudentGrade
    {
        string StudentName();
        int StudentGrade();
    }
}













namespace sample3
{
    public class Student : Person, IStudentGrade
    {
        public Student(string FirstName, string LastName, string Gender)
            : base(FirstName, LastName, Gender)
        {
            Console.WriteLine(FirstName, LastName, Gender);
        }


     }
  }

推荐答案


这篇关于如何实现将由student类实现的接口类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 18:40