Вы находитесь на странице: 1из 20

Dot Net Programming

Unit III

Explain the concept of Object Oriented


Programming.
What are the featuresFeatures
of OOP?
of OOP :Object Oriented
Programming:-

The purpose of the pure objectoriented programming is to


create an object, in code, that
has certain properties and
methods.
Class :- A Class is a user
defined data type. Variables
and functions can be created
within it.
Object :- An Object is an
element (or instance) of a
class; objects have the
behaviors of their class.

Explain Inheritance with an example


Inheritance is a fundamental
feature of an Object-Oriented
programming. It is the process
of creating a new Class, called
the Derived Class, from the
existing class, called the Base
Class.

Base Class (Uday kumarFather)

Sub class (Ram


son)

Class A
Public _value As Integer
Public Sub Display()
Console.WriteLine(_value)
End Sub
End Class
Class B : Inherits A
Public Sub New(ByVal value As
Integer)
MyBase._value = value
End Sub
End Class
Module Module1
Sub Main()
Dim b As B = New B(5)
b.Display()
End Sub
End Module

Write about encapsulation, inheritance and


polymorphism?
Encapsulation :
Data
encapsulationis
a
mechanism of bundling the
data(variables), and the methods
that use them.

Inheritance :
Inheritance can be defined as the
process where one class acquires
the properties (methods and
fields) of another.

Polymorphism :
Polymorphism is the ability of an
object to take on many forms.
The most common use of
polymorphism in OOP occurs

What is binding? Explain Early and Late


Binding with an example code
Bindingrefers to the link between
method call and method
definition.
Static Binding : (Static Binding)
When type of the object is
determined at compiled time(by
the compiler), it is known as static
binding.
Dynamic Binding : (Early Binding)
When type of the object is
determined at run-time, it is
known as dynamic binding.

Write about overloading, overriding


and shadowing
Overloading :- When two or more
methods (functions) in the same
Class have the same name but
different parameters is called
method overloading.
Overriding :When two or more
methods (functions) have the
exact same method name, return
type, number of parameters, and
types of parameters as the method
in the parent class is called method
Overriding.
Shadowing :- Shadowing hides a
method in a base class.

How to create tree views?


The ASP.NETTreeViewcontrol is
designed to present users with
data in a hierarchical structure.
Users can open individual nodes
that can in turn contain child
nodes.
Procedure
to
create
a
TreeView Control in ASP.NET
Step 1
Open Microsoft Visual Studio then
select
"File"
->
"New"
->
"Project..."
(Ctrl+Shift+N).
Step 2
Add an ASP.NET Web Forms
Application and give it the name
TreeViewControl.
Step 3

Step 4
Now drag and drop a
TreeViewControl from the ToolBox.
Step 5
Write the code inside the
<Nodes> </Nodes> element and
create Nodes of the TreeViewin
the "TreeView.aspx.
Step 6
Now run the code and see the
following output:

What is File Stream Class? Describe the


public properties of File Stream Objects
File Stream Class : Provides aStreamfor a file, supporting both
synchronous and asynchronous read and write operations.

How to create or open a file with FileStream


class?

Write an application to Fill 2D Figures with


Brushes

How to add images to Image List?


Create an ImageList Object, populate it, and display.
Construct the ImageList.
Set the ImageSize property to a larger size
16).

(the default is 16 x

Add two images to the list.


Get a Graphics object from the form's handle.
Loop through the images in the list, drawing each image.
Call Application.DoEvents to force a repaint of the form.
Call the Sleep method to allow the user to see the image.

Write the procedure to create font


dialogue
In the .NET Framework, the Font dialog box is
represented
by
theFontDialogclass.
The
FontDialog
class
is
derived
from
theCommonDialogclass.
At design time, to provide a Font dialog to your
application, from the Dialogs section of the Toolbox,
you can click the FontDialog buttonand click the
form. To programmatically provide a Font dialog box to
your application, declare a variable of type FontDialog
and use the newoperator to allocate its memory.
To display a Font dialog box to the user, call
itsShowDialog()method. Here is an example:

How to add controls to tab pages at


run time?
Creating a simpleTabPagewith a specificNameand adding
toControlsorTabPagesworks
and
so
does
removing
withRemoveByKeyon bothControlsandTabPages.

it
it

Discuss Access modifiers

Describe constructor with an


example

Constructor is a special method


of a class which will invoke
automatically
whenever
instance or object of class is
created.
Example :classSampleA
{
publicSampleA()
{
Console.WriteLine("Sample A
Test Method");
}
}

What is meant by polymorphism? Explain


the two ways to handle polymorphism in VB
Polymorphism:-Polymorphism is one of the crucial features of
VB.NET, It means "The ability to take on different form", It is also
called as Overloading which means the use of same thing for
different purposes.
Example:-polymorphism real word examples
areStudent,Manager,Animaland etc.
Polymorphism can be divide in to two parts, that are given bellow:Compile time polymorphism
Run time polymorphism
Compile time polymorphism:- compile time polymorphism
achieved by "Method Overloading", means that same name function
with deferent parameters in same class called compile time
polymorphism.
Run time Polymorphism:-Run time polymorphism achieved by
"Method Overriding or Operator Overloading", means that same
name function withsame parameters in different classes called Run

Explain Polymorphism with an example


Polymorphism:-Polymorphism is one of the crucial features of
VB.NET, It means "The ability to take on different form", It is also
called as Overloading which means the use of same thing for
different purposes.
Example:-polymorphism real word examples
areStudent,Manager,Animaland etc.
Your mobile phone, one name but many forms:
As phone
As camera
As mp3 player
As radio

How do you handle Graphics in VB? Explain


in brief
In Visual Basic 6.0, various graphics methods and properties are
used to draw on aFormorPictureBoxcontrol. Graphics in Visual
Basic 6.0 are based on the Windows Graphics Device Interface (GDI)
APIs.

SIMILAR QUESTIONS
Describe constructor with an example
Discuss Access modifiers with an example
code
What is meant by polymorphism? Explain
the two ways to handle polymorphism in VB
Explain Polymorphism with an example
How do you handle Graphics in VB? Explain
in brief
Explain about Graphics methods

SIMILAR QUESTIONS
What is an Interface and how to create an
Interface
Explain Interface
What is the difference between Stream
Writer and Binary Writer? Explain

Вам также может понравиться