0% found this document useful (0 votes)
44 views18 pages

Fakhera Nazir

The document outlines 8 tasks related to object-oriented programming concepts in ASP.NET, including working with interfaces, abstract classes, operator overloading, and constructor overloading by implementing methods, classes, and interfaces to demonstrate concepts like inheritance, polymorphism, and encapsulation.

Uploaded by

aymen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views18 pages

Fakhera Nazir

The document outlines 8 tasks related to object-oriented programming concepts in ASP.NET, including working with interfaces, abstract classes, operator overloading, and constructor overloading by implementing methods, classes, and interfaces to demonstrate concepts like inheritance, polymorphism, and encapsulation.

Uploaded by

aymen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 18

OOP with ASP.

NET

Fakhera Nazir
Interfaces
Abstract Classes
Task 1 & 2
• Add items using Add Button Event Handler &&
and remove item using Remove Button Event
Handler from asp:ListBox.

• Declare a base Class “B” having a method


display() that returns values of variable (num1
and num2) and a derived class “D”. Initialize the
values of base class constructor (num1 and
num2) through derived class D using constructor
inheritance. After that call display() through
derived class and display the values.
Task 3
• Implement the following abstract class and display the
result of methods given below:

Abstract class Animal {


int a;
String b;
int NoOfLegs(){return 4; }
abstract string EatFood(){ };
bool canRun() { return true; }
abstract string ClassOfAnimal(){};//must classify
Reptiles, Mammals or Vertebrate.
}
Task 4
• Create a class “Parts” having memebers
part_id and part_name. Add 5 objects of Parts
in list List<Parts> and display the values of list.
Task 5
• Declare interfaces IAdd and ISub having methods given below: Allow class
Multiplication{} to implement the below interfaces and display the results
of each method.

• IAddstring add(int a, int b), string add(int a, int b,


int c), string add(int a, int b, int c, int d).
• ISub string subtract(int a, int b), string
subtract(int a, int b, int c).
Task 6 & 7
1) Implement operator overloading for plus operator where we
can add two objects directly using + operator.
Example: c1+c2 should return c3 and display values
of c3.value1 and c3.numb2.

2) Implement increment operator overloading where


we can increment two values on calling single (+
+)operator.
Example: int c=1; c++; should return 3 instead of 2.
Task 8
• Implement constructor Overloading using 3
overloads for a constructor including default
one and display the values by calling each
constructor.

You might also like