Hi Brat,
Well, I will try to explain it clearly:
imports: used at the very top of your code. It is used to import
already compiled libraries. It also simplifies your code. For example:
If you programming an application that requires alot of drawing, you
don't want to keep saying:
system.drawing.drawRectangle...
system.drawing.drawline...
system.drawing ....etc
you can import the system.drawing, and use the methods you need without
writing the full path. ie
drawRectangle...
drawline...
etc.
Inheritance:
Inheritance is a great feature in object oriented program (OOP). It
allows for code reuse and expansion. I remember in my programming
couses they always use the car class example. So, I am going to use it
again
Assume you have a class called car. Every car, has an engine,
transmission, make, model, four wheels. These properties are shared
among all cars. These are the basic car parts. You have 2door and 4
door cars. Lexury and convintional cars. SUVs, minvans ..etc. You don't
want to have one class that has all these information. And you don't
want to rewrite these info everytime a new type of car comes out. Let's
translate the above to code:
Class car
private Engine as string
private Transmission as string
private make as string
private model as string
public sub new (byval e as string, byval t as string, _
byval ml as string, byval mk as string)
Engine = e
transmission =t
make =ml
model =mk
end sub
end class
Now we have a sport car that is 2 doors, 2 seats, got a turbo.... we
dont want to retype every thing from the car class into the sport car
class. So we inherit it.
Class SportCar inherits car
private numDoors as integer
private numSeats as integer
private GotTurbo as boolean
public sub new (byval d as integer, byval s as integer, _
byval t as boolean, byval eng as string, byval trans as
string, _
byval make as string, byval model as string)
mybase (eng,trans,make,model)
numDoors = d
numSeats = s
GotTurbo = t
end sub
end class
The above is a very simple example it definitely get nastier.
Implement:
In OOP a class can't inherit from multiple class. Only one class. But
you can implement more than one interface. And a class can inherit
anther class and implement an interface at the same time. An interface
is a class but it only has signiture of methods or declaration of
properties. By implementing an interface, you are forcing the class to
define those methods/ properties
I hope I was able to clearify the difference. If you have more
questions let me know.
Cheers,
Ahmed