4. 1. Saif El-deen
2. Fatema Mahmoud
3. Mahmoud Atef
4. Hadeer El-naggar
5. Hagar Farouk
6. Abd Al-Rahman Allam
7. Mohamed Reda
8. Nada Maher
9. Mahmood mohey
The heroes who finished Exercise 2
5. • A class is a way to define new
advanced data types.
• It contains attributes that describes
him.
• And it holds the functions that
access his attributes.
Classes
6. Class Frog {
private string name;
private string color;
public Frog() { } [constructor]
public void set_name(string name) { } [setter]
public string get_name () {} [getter]
public void jump() { }
}
Classes
7. Object
It is an instance of a class:
Frog kermit = new Frog () ;
Each object holds a (Unique)
assignment of value to the class
attributes:
kermit.set_Name (“Kermit The Frog”);
kermit.set_Color (“Green”);
kermit.set_hight (183);
Classes
9. Constructor:
• is the first function the
object does after its creation.
• Constructor can either hold
parameters or not.
• class Frog {
Frog ()
{
Console.WriteLine(“I am a frog”);
}
}
Classes
10. • Access modifiers are keywords set
the visibility of an attribute or
function in a class to the other
classes.
private string name;
public string eye_color ;
public int hight;;
kermit.set_name (“Kermit The Frog”) ;
kermit.eye_color = “Green” ;
kermit.set_hight(183) ;
Classes
12. • Is when two classes share
attributes with each others.
• Like for example harry (child) and
his mother (parent)
– Harry is a wizard as his mother
– Has his mother eyes
• All these are attributes harry
inherited from his mother
Inheritance
14. 1. Learning programming basics on
console (C#)
2. How to design UI (XAML)
3. how to design database (SQL Server)
4. Integrate all your skills into APP
Our Workshop Plan
using System;
namespace namespace1
{
class Bird
{
private string name;
public Bird ()
{
Console.WriteLine("I am a bird");
}
public void setName (string n_name)
{
name = n_name;
}
public string getName ()
{
return name;
}
public void walk ()
{
Console.WriteLine("I can walk");
}
}
class Eagle : Bird
{
public Eagle ()
{
Console.WriteLine("I am an eagle!");
}
public void fly()
{
Console.WriteLine("I can fly");
}
}
class Duck : Bird
{
public Duck()
{
Console.WriteLine("I am a duck!");
}
public void swim ()
{
Console.WriteLine("I can Swim");
}
}
class Program
{
public static void Main(string [] args)
{
Eagle my_eagle = new Eagle();
my_eagle.setName("Chaise");
Console.WriteLine("My name is: " + my_eagle.getName());
my_eagle.fly();
Console.WriteLine("\n");
Duck my_duck = new Duck();
my_duck.setName("Quirk");
Console.WriteLine("My name is: " + my_duck.getName());
my_duck.swim();
Console.ReadKey();
}
}
}