Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var obj = new Student("Muhammad");
- var obj2 = new SpecialStudent("Muhammad", "Siddiqi");
- Console.WriteLine(
- "Is IStudent: {0}, Is Student: {1}, Is SpecialStudent: {2}",
- obj is IStudent,
- obj is Student,
- obj is SpecialStudent); //True, True, False
- Console.WriteLine(
- "Is IStudent: {0}, Is Student: {1}, Is SpecialStudent: {2}",
- obj2 is IStudent,
- obj2 is Student,
- obj2 is SpecialStudent); //True, True, True
- Console.WriteLine(
- "Is Student Object implements ICalculator<int> interface: {0}",
- obj is ICalculator<int>); //False
Add Comment
Please, Sign In to add comment