Anteneh Girma UU80323R
Anteneh Girma UU80323R
Programming in VB.NET
Think of a class as a blueprint or template for Objects are instances of a class. They are actual,
creating objects. It defines the properties (data) and concrete entities that hold data and can perform
methods (actions) that objects of that class will actions based on the class definition. For example,
possess. a "Car" class might have properties like color, make,
and model, and methods like "StartEngine" and
"Drive".
Inheritance
Base Class
1
The foundation for inheritance. It defines common properties and methods shared by subclasses.
Derived Class
2 Inherits from a base class, gaining its properties and methods. Can
also add its own unique features.
Code Reuse
Inheritance promotes code reusability. Derived
3
classes inherit existing code from the base class,
reducing redundancy.
Polymorphism
Method Overriding
3 A derived class can provide a different
implementation of a method inherited from its
base class.
Encapsulation
3 Loose Coupling
Interfaces promote loose coupling. Classes interact
through interfaces, reducing dependencies and making
the code more modular.
Exception Handling
1 Try Block
Contains code that might potentially throw an exception.
2 Catch Block
Handles the exception if one is thrown in the try block.
3 Finally Block
Executes regardless of whether an exception
was thrown or caught. Often used for cleanup
tasks.
Object-Oriented
Programming Summary in
VB.NET
OOP in VB.NET uses classes and objects to structure
code. Key principles: