WEEK 7-1
ABSTRACT CLASSES
ABSTRACT
Before anything, take a look at the code below
ABSTRACT
How do we use them?
ABSTRACT
Abstract classes CANNOT be instantiated. So what are they good for? How can you use them? You might say that abstract classes are meant to be inherited It contains abstract methods Abstract methods are methods with no definition If abstract methods have no definition, how can you use them?
ABSTRACT
The derived class implements the abstract method’s definition Why doesn’t the abstract method use the virtual modifier? By default abstract methods are virtual methods so there is no need to explicitly declare them as such. Abstract methods may only exist in Abstract classes
ABSTRACT
Note: static and virtual modifiers are not allowed in abstract classes Properties are also declared abstract
ABSTRACT
ABSTRACT
ABSTRACT
ABSTRACT
INTERFACE
In general, an interface is an intermediary element between two things. (this is not the definition you need for your tests) Your cell phones have either keypads or touchscreen interfaces to allow you to perform certain functions of your phone. You don’t know the internal constructs but through the interface you know exactly what it can do
INTERFACE
When you look at the interface, you can tell something about the class that implements the interface You would be able to see the behavior of the class or what it’s suppose to do by looking at the interface
INTERFACE
You declare an interface using the interface keyword And using the convention discussed earlier, the interface name starts with an uppercase I
INTERFACE
An interface can contain
Methods Properties Indexers Events
As you may have no noticed, fields are not included Members of an interface are public by default You cannot modify them
INTERFACE
INTERFACE
Members of an interface only contain signatures of methods, properties, indexers, or events
INTERFACE
This