deleyd
asked on
Interface vs. Virtual vs. Abstract vs. Inheritance
abstract class TwoDShape {
variables
methods
...
}
public interface ISeries {
variables
methods
...
}
class MyClass {
variables
methods
...
}
It seems the syntax in the main code when it comes to defining a class which {inherits a regular class/implements an interface/inherits an abstract class} is the same for all three, is that correct?Then in main code:
class Triangle : TwoDShape {
}
class ByTwos : ISeries {
}
class MyExt : MyClass {
}
Is the virtual keyword only for methods and variables and not for classes?Interface - contract "You must implement these methods." Contains no code.
Abstract - class meant to be inherited. Class can not be instantiated. Contains code.
What is the syntax for a class which implements more than one interface?
Virtual - keyword placed on methods "Here's a default method to use unless you override it with something better."
So do I have this correct so far?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.