Whenever we implement any Interface in C# or JAVA

why is this compulsory to implement all the methods insight that Interface?

If you did not force all the elements of an interface then what would happen when a missing element was called? (see below)

foreach(ITemp tmp in myCollection)
{
     string name = tmp.GetName();
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.