Metot Gölgeleme (Shadowing)
Örnek
Örnek
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
Ogretmen Objemiz = new Ogretmen { Ad = "Osman", Soyad = "Karaosman", Brans = "Ogretmen" };
Objemiz.AdSoyadYazdir(); //Okul Ögretmeni :OsmanKaraosmanOgretmen
}
}
public class OkulPersoneli {
public string Ad;
public string Soyad;
public void AdSoyadYazdir() //Metot Gölgeleme (Shadowing)
{
MessageBox.Show("Okul personeli :" + Ad + Soyad);
}
}
public class Ogretmen : OkulPersoneli
{
public string Brans;
public void AdSoyadYazdir() //Metot Gölgeleme (Shadowing)
{
MessageBox.Show("Okul Ögretmeni :" + this.Ad + this.Soyad + Brans);
}
}
}
Örnek
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
Kediler Canli = new Kediler();
Canli.SesCikar();
}
class Hayvan
{
public void SesCikar()
{
MessageBox.Show("Genel hayvan sesi...");
}
}
class Kediler : Hayvan {
public void SesCikar()
{
MessageBox.Show("Miyav...");
}
}
}
}