To record class for a student and professor in C#, we can create two separate classes - one for the student and one for the professor. Here's an example implementation:
main.cs899 chars38 lines
In the above code, we have created two separate classes - Student
and Professor
- that hold information about a student and a professor, respectively. We have used constructor to initialize their properties: Name
, RollNumber
, and Branch
for the Student
class, and Name
, EmployeeID
, and Department
for the Professor
class.
By creating separate classes, we can conveniently store and manipulate information about students and professors in our code.
gistlibby LogSnag