Q:
C#.Net find output programs (Interface) | set 2
belongs to collection: C#.Net find output programs
C#.Net find output programs
- C#.Net find output programs (Data Types) | set 1
- C#.Net find output programs (Data Types) | set 2
- C#.Net find output programs (Data Types) | set 3
- C#.Net find output programs (Operators) | set 1
- C#.Net find output programs (Operators) | set 2
- C#.Net find output programs (Operators) | set 3
- C#.Net find output programs (const Keyword) | set 1
- C#.Net find output programs (this Keyword) | set 1
- C#.Net find output programs (readonly Keyword) | set 1
- C#.Net find output programs (static Keyword) | set 1
- C#.Net find output programs (static Keyword) | set 2
- C#.Net find output programs (if else) | set 1
- C#.Net find output programs (if else) | set 2
- C#.Net find output programs (if else) | set 3
- C#.Net find output programs (switch statement) | set 1
- C#.Net find output programs (switch statement) | set 2
- C#.Net find output programs (switch statement) | set 3
- C#.Net find output programs (goto) | set 1
- C#.Net find output programs (Loops) | set 1
- C#.Net find output programs (Loops) | set 2
- C#.Net find output programs (Loops) | set 3
- C#.Net find output programs (Arrays) | set 1
- C#.Net find output programs (Arrays) | set 2
- C#.Net find output programs (Arrays) | set 3
- C#.Net find output programs (default Arguments) | set 1
- C#.Net find output programs (default Arguments) | set 2
- C#.Net find output programs (Parameter Passing) | set 1
- C#.Net find output programs (Enumeration) | set 1
- C#.Net find output programs (Enumeration) | set 2
- C#.Net find output programs (Boxing & Unboxing) | set 1
- C#.Net find output programs (Structure) | set 1
- C#.Net find output programs (Structure) | set 2
- C#.Net find output programs (Structure) | set 3
- C#.Net find output programs (Classes & Objects) | set 1
- C#.Net find output programs (Classes & Objects) | set 2
- C#.Net find output programs (Classes & Objects) | set 3
- C#.Net find output programs (Constructors & Destructors) | set 1
- C#.Net find output programs (Constructors & Destructors) | set 2
- C#.Net find output programs (Constructors & Destructors) | set 3
- C#.Net find output programs (Inheritance) | set 1
- C#.Net find output programs (Inheritance) | set 2
- C#.Net find output programs (Inheritance) | set 3
- C#.Net find output programs (Interface) | set 1
- C#.Net find output programs (Interface) | set 2
- C#.Net find output programs (Method Overloading) | set 1
- C#.Net find output programs (Method Overloading) | set 2
- C#.Net find output programs (Method Overriding) | set 1
- C#.Net find output programs (Method Overriding) | set 2
- C#.Net find output programs (Method Overriding) | set 3
- C#.Net find output programs (Operator Overloading) | set 1
- C#.Net find output programs (Operator Overloading) | set 2
- C#.Net find output programs (Operator Overloading) | set 3
- C#.Net find output programs (Namespace) | set 1
- C#.Net find output programs (Namespace) | set 2
- C#.Net find output programs (Exception Handling) | set 1
- C#.Net find output programs (Exception Handling) | set 2
- C#.Net find output programs (Exception Handling) | set 3
Answer 1:
Output:
Explanation:
In the above program, we created an interface IMath that contains the declaration of Add() method and Sub() method then we inherited IMath interface in the Math class and implemented both methods in Math class.
Let's look to the Main() method, here I created an object of Math class using interface IMath and then called Add() and Sub() method.
Answer 2:
Output:
Explanation:
The above program will generate syntax error because we cannot define a private interface.
Answer3:
Output:
Explanation:
The above program will generate syntax errors because we inherited interface in two classes Math1 and Math2. But we did not implement Sub() method in Math1 class and did not implement Add() method in Math2 class.
Answer 4:
Output:
Explanation:
In the above program, we created two interfaces IMath1 and IMath2. Then we inherited both interfaces in Math class, here we implemented Add() and Sub() method in the Math class.
Now come to the Main() method, here we created an object of Math class and then called Add() and Sub() method that will print addition and subtraction of given arguments respectively.
Answer 5:
Output:
Explanation:
In the above program, we created two interfaces IMath1 and IMath2. Then we inherited the IMath1 interface in the IMath2 interface then IMath2 inherited in the Math class, here we implemented Add() and Sub() method in the Math class.
Now come to the Main() method, here we created an object of Math class and then called Add() and Sub() method that will print addition and subtraction of given arguments respectively.
need an explanation for this answer? contact us directly to get an explanation for this answer