To answer this question, let's analyze the given code:
public class B : A {
public B(int i) : base(i) {
}
}
This code snippet shows the class B
inheriting from class A
. The constructor in class B
takes an argument of type int
and calls the base constructor of class A
with the same argument.
Based on this information, we can conclude that:
A. One constructor takes an argument of type i
- This option is incorrect because the argument in the constructor of class B
is named i
, not i
itself.
B. There is only a default constructor - This option is incorrect because the presence of the B(int i)
constructor in class B
indicates that there is a non-default constructor in class A
.
C. One constructor takes an argument of the type int
- This option is correct because the B(int i)
constructor in class B
calls the base constructor A(int i)
, indicating that there is a constructor in class A
that takes an argument of type int
.
D. a and b - This option is incorrect because option A is incorrect. Only option C is correct.
Therefore, the correct answer is option C.