Interfaces

Q1:
Which of the following is the correct way to implement the interface given below?
interface IPerson
{ 
    String FirstName
    {
        get;
        set; 
    } 
}

A
class Employee : IPerson
{
    private String str; 
    public String FirstName
    {
        get
        { 
            return str;
        } 
        set
        { 
            str = value;
        } 
    } 
}

B
class Employee
{
    private String str;
    public String IPerson.FirstName
    { 
        get
        { 
            return str;
        } 
        set
        { 
            str = value;
        } 
    } 
}

C
class Employee : implements IPerson
{
    private String str; 
    public String FirstName
    { 
        get
        { 
            return str;
        } 
        set
        {
            str = value; 
        } 
    } 
}

D None of the above

ANS:A -

class Employee : IPerson
{
    private String str; 
    public String FirstName
    {
        get
        { 
            return str;
        } 
        set
        { 
            str = value;
        } 
    } 
}

No answer description is available. Let's discuss.



img not found
img

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.