What is the proper header for a class that intends to use an interface.

  1. class MyClass IFace

  2. class MyClass ; IFace

  3. class MyClass : IFace

  4. class MyCalss {IFace}

  5. class MyCalss(IFace)


Correct Option: C
Explanation:

To properly implement an interface in a class, you would use the syntax specified in option C: class MyClass : IFace.

The colon (:) is used to indicate that the class MyClass is implementing the IFace interface. This allows the class to inherit the methods and properties defined in the interface.

Options A, B, D, and E do not follow the correct syntax for implementing an interface.

Option A, class MyClass IFace, is incorrect because it does not indicate that MyClass is implementing the IFace interface.

Option B, class MyClass ; IFace, is incorrect because the semicolon (;) is not used to indicate interface implementation.

Option D, class MyCalss {IFace}, is incorrect because the interface implementation is not specified after the class declaration.

Option E, class MyCalss(IFace), is incorrect because parentheses are not used to indicate interface implementation.

Therefore, the correct answer is C. class MyClass : IFace.

Find more quizzes: