C# Notes
C# Notes
Static methods must use static members and other static methods
Able to create reference variables which refer to objects in terms of interfaces they
implement,
rather than the particular type that they are.
If you apply the "abstraction" technique properly you should end up with a system
creation process which goes along the lines of:
gather as much metadata as you can about the problem; what is important to the
customer, what values need to be represented and manipulated and the range of
those values
identify classes that you will have to create to represent the components in the
problem
identify the actions (methods) and the values (properties) that the components
must provide
put these into interfaces for each of the components
decide how these values and actions are to be tested
implement the components and test them as you go
base.functionCall
abstract methods may contain fully implemented methods, interface only holds
declarations
Interface: lets you identify a set of behaviours (i.e. methods) which a component
can be made to implement. Any component which implements the interface can be
thought of in terms of a reference of that interface type. A concrete example of this
would be something like IPrintHardCopy. Lots of items in my bank system will need
to do this and so we could put the behaviour details into the interface for them to
implement in their own way. Then our printer can just regard each of the instances
that implement this interface purely in this way. Interfaces let me describe a set of
behaviours which a component can implement. Once a component can implement
an interface it can be regarded purely in terms of a component with this ability.
Objects can implement more than one interface, allowing them to present different
faces to the systems that use them.
Abstract: lets you create a parent class which holds template information for all the
classes which extend it. If you want to create a related set of items, for example all
the different kinds of bank account you might need to deal with, including credit
card, deposit account, current account etc. then the best way to do this is to set up
a parent class which contains abstract and non-abstract methods. The child classes
can make use of the methods from the parent and override the ones that need to be
provided differently for that particular class.
interface IStaff
{ int Age
{ get; set; } }