C# Programming - Interfaces - Discussion
Discussion Forum : Interfaces - General Questions (Q.No. 1)
1.
Which of the following statements is correct about the C#.NET code snippet given below?
interface IMyInterface
{
void fun1();
int fun2();
}
class MyClass: IMyInterface
{
void fun1()
{ }
int IMyInterface.fun2()
{ }
}
Discussion:
15 comments Page 2 of 2.
Sudhakar said:
1 decade ago
void IMyInterface.fun1()
int IMyInterface.fun2()
(or)
public void fun1()
public int fun2()
As per multiple choice answer should be 'E'.
int IMyInterface.fun2()
(or)
public void fun1()
public int fun2()
As per multiple choice answer should be 'E'.
Mahdi said:
1 decade ago
The answer is wrong because
1.fun2 should return an int value
2. fun1 and fun2 in Myclass should be public
1.fun2 should return an int value
2. fun1 and fun2 in Myclass should be public
Pallavi said:
2 years ago
Interface can be implemented explicitly using <InterfaceName>. <MemberName>.
Pramod Khandare said:
1 decade ago
No need to give Interface name while giving definition to method void fun1().
Omkar said:
8 years ago
void fun1() must be public.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers