
It looks like you're new here. If you want to get involved, click one of these buttons!
Hey, I have one study question and question. What's wrong with this code? I corrected the redundant ";" and "stud.DisplayStudentInfo (1);" . At the end I get the error (photo above). Could someone explain this to me? Please :)
class Program
{
static void Main(string[] args)
{
dynamic stud = new Student();
stud.Init();
stud.DisplayStudentInfo(„1”); //I think the bug is here
}; // I think the bug is here
}
public class Student
{
public void DisplayStudentInfo(int id)
{
Console.WriteLine(id);
}; //I think the bug is here
}
Answers
Your Student class has not defined a method called Init(). What are you trying to achieve with it?