Adding the Interface to the Class
Now that the interface has been specified, a class can be instructed to implement it in its declaration in the
inheritance clause. Since classes can implement multiple interfaces—compared to only being able to inherit
from one class—the interface implementation is specified in a comma-delimited list. For example:
public class Dinosaur : IComparable, ICarnivore
{
...
}
As with the IComparable interface, if you run this code without placing the member required by ICarnivore in
the class, you’ll get a syntax error.
|
|
Search Engine Optimization
 
Syndication Viewer
Our Web host:
IX WebHosting
|