1. can abstract classes provide non-Abstract execution methods? What about interfaces?
A: The abstract class can be written as follows:
CopyCodeThe Code is as follows: public abstract class
{
Public String getweburl ()
{
Return "jb51.net ";
}
Public abstract string getwebname ();
}
Public Class B:
{
Public override string getwebname ()
{
Return "";
}
}
Run: B = new B ();
Response. Write (B. getweburl ());
There is no error during compilation, but the interface itself can only contain members but not specific implementations, and abstract functions can only exist in abstract classes. Therefore, interfaces only have method signatures, but there is no specific implementation, it is not an abstract function, for example, C # copying code.
Interface IA
{
String getweburl ();
String getwebname ();
}
2. Must the members in the interface be implemented by their subclass?
A: An interface is a special case of an abstract class. Abstract functions must be overwritten and implemented by their subclasses.
Iii. Can virtual keywords be used in abstract classes?
A: No. The abstract class can only contain abstract methods and abstract accessors.
4. can abstract classes be instantiated?
A: No.