Computer Science C#
What object(s) do(es) not have a “this” const variable? instance object static object struct object All of the Above None of the Above Interfaces allow only what members? public prototypes instance static reference
Expert Answer
q27.none of the above
When applied in an object declaration, it indicates that the object is a constant. its value does not change, unlike a variable. This basic use – to declare constants – has parallels in many other languages.
Q28.public prototype
Interfaces are contracts that classes require to implement in order to ensure that the consumer of some given class will receive instances of a class which mandatorily implements an interface.
If interfaces would allow private members, the fact that you couldn’t invoke interface members which are hidden from the public surface would defeat the purpose of an interface, because a consumer wouldn’t be able to call these private members (so… why it would use an interface?).
For example, interfaces provide typing to objects. If some consumer code relies on receiving objects implementing some interface to avoid redundant dependencies on the assembly which uses it and the whole assembly has access to an interface which doesn’t provide members publicly, how that consumer would work with the so-called object?
public interface IDoesSomething { private void Do(); } public void SomeMethod(IDoesSomething some) { some.????? }