Click here to Skip to main content
15,911,141 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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);
        }

          
     }
  }
Posted
Updated 26-Feb-17 19:17pm

1 solution

The very easy way... In Visual Studio, the interface IStudentGrade on the Student class will name will have a squiggly line under it. Right-click, select refactor, then Implement Interface.

Manually, same as the interface but with a body (functional code).
 
Share this answer
 
Comments
Member 13018326 27-Feb-17 1:23am    
Thanks Graeme_Grant!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900