0
C#
2 classes: Student & Teacher with 4 attributes in each class. An explicit default constructor, Parameter constructor & PrintData Function. Create objects of each class in Program Class using parameterize constructor & explicit default constructor. also call printdata function on each object. Please can you tell me what is the coding of this statement in c#
2 Answers
0
interface IDataPrinter
{
string Attribute1;
string Attribute2;
string Attribute3;
string Attribute4;
void PrintData(string data);
}
class Student : IDataPrinter
{
public Student() {}
public Student(string parameter) {}
public void PrintData(string data)
{
// do whatever you want here ...
}
}
class Teacher : IDataPrinter
{
public Teacher() {}
public Teacer(string parameter) {}
public void PrintData(string data)
{
// do whatever you want here ...
}
}
class Program
{
public static void Main(string[] Args)
{
Student student1 = new Student();
Student student2 = new Student("foobar");
Teacher teacher1 = new Teacher();
Teacher teacher2 = new Teacher("hulu");
student1.PrintData("foo");
student2.PrintData("bar");
teacher1.PrintData("fooing");
teacher2.PrintData("baring");
}
}
0
interface IDataPrinter .... what is the concept of this word