(AN AUTONOMOUS UNIT OF RANCHI UNIVERSITY FROM 2009)
- Prakash Kumar, Dept. of CA
-Raju Manjhi, Dept. of CA
__________________________________________________________________________________
Programming in Visual Basic.NET
BCA/IT- Sem-IV(Old Course)
Type
classification
The common type system supports two general categories of types,
each of which is further divided into subcategories:
· Value
types
Value types directly contain their data, and instances of value
types are either allocated on the stack or allocated inline in a structure.
Value types can be built-in (implemented by the runtime), user-defined, or
enumerations.
· Reference
types
Reference types store a reference to the value's memory address,
and are allocated on the heap. Reference types can be self-describing types,
pointer types, or interface types. The type of a reference type can be
determined from values of self-describing types. Self-describing types are
further split into arrays and class types. The class types are user-defined
classes, boxed value types, and delegates.
NOTE:
· Variables
that are value types each have their own copy of the data, and therefore
operations on one variable do not affect other variables. Variables that are
reference types can refer to the same object; therefore, operations on one
variable can affect the same object referred to by another variable. All types
derive from the System.Object base type.
· Delegates:
The runtime supports reference types called delegates that serve a purpose
similar to that of function pointers in C++. Unlike function pointers,
delegates are secure, verifiable, and type safe. A delegate type can represent
any method with a compatible signature. While function pointers can only
represent static functions, a delegate can represent both static and instance
methods. Delegates are used for event handlers and callback functions in the
.NET Framework.
Types and Assemblies
The runtime uses assemblies to locate and load types. The assembly
manifest contains the information that the runtime uses to resolve
all type references made within the scope of the assembly.
A type name in the runtime has two logical parts:
- the
assembly name
- name
of the type within the assembly.
Two types with the same name but in different assemblies are
defined as two distinct types.
Assemblies provide consistency between the scope of names seen by
the developer and the scope of names seen by the runtime system. Developers
author types in the context of an assembly. The content of the assembly a
developer is building establishes the scope of names that will be available at
run time.
Types and
Namespaces
From the viewpoint of the runtime, a namespace is just a
collection of type names. Particular languages might have constructs and
corresponding syntax that help developers form logical groups of types, but
these constructs are not used by the runtime when binding types. Thus, both
the Object and String classes are part of
the System namespace, but the runtime only recognizes the full
names of each type, which are System.Object and System.String, respectively.
You can build a single assembly that exposes types that look like
they come from two different hierarchical namespaces, such as
System.Collections and System.Windows.Forms.
If you create a tool to represent types in an assembly as
belonging to a hierarchical namespace, the tool must enumerate the types in an
assembly or group of assemblies and parse the type names to derive a
hierarchical relationship.
Object Oriented terminology:
An object is a structure containing data and
methods that manipulate the data. Almost everything you do in Visual Basic is
associated with objects. If you are new to object-oriented programming, the
following terms and concepts will help you get started.
Classes :
A class is an abstract representation of something,
whereas an object is a usable example of the thing the class
represents.
“The one exception to this rule is shared class members, which are
usable in both instances of a class and object variables declared as the type
of the class.”
Fields : Classes are made of fields, properties, methods, and
events. Fields and properties represent information that an object contains.
Properties :Properties are retrieved and set like fields, but are
implemented using property Get and Set procedures,
which provide more control on how values are set or returned.
Methods :Methods represent actions that an object can perform. We
define methods by adding procedures, either Sub routines or
functions, to your class.
Events : Events are notifications an object receives from, or
transmits to, other objects or applications. Events allow objects to perform
actions whenever a specific occurrence takes place.
Instance : Initializes a new instance of the Instance class
Fields, properties, methods, and events are only one half of the
object-oriented programming equation.
True object-orient programming requires
objects to support three qualities: encapsulation, inheritance, and
polymorphism.
Encapsulation means that a group of related properties, methods, and
other members are treated as a single unit or object. Objects can control how
properties are changed and methods are executed. Encapsulation also makes it
easier to change your implementation at a latter date by letting you hide
implementation details of your objects, a practice called data hiding.
Inheritance describes the ability to create new classes based on
an existing class. The new class inherits all the properties and methods and
events of the base class, and can be customized with additional properties and
methods.
Polymorphism means that you can have multiple classes that can be
used interchangeably, even though each class implements the same properties or
methods in different ways. Polymorphism is essential to object-oriented
programming because it allows you to use items with the same names, no matter
what type of object is in use at the moment.
Sir java , web designing and css pe v content laye.
ReplyDeleteSure Riya.
ReplyDeleteSuperb content sir. Really appreciate the good work to educate us in the lockdown. Lot of students are going to get benefit from this.
ReplyDeleteYours always...
DeleteVery nice work and content too 👌👌
ReplyDeleteThanks:)
DeleteNice presented
ReplyDelete