Download - BM-104 Nesneye Yönelik Programlama Bahar 201 3 ( 6 . Sunu ) ( Yrd . Do ç . Dr. Deniz Dal)
![Page 1: BM-104 Nesneye Yönelik Programlama Bahar 201 3 ( 6 . Sunu ) ( Yrd . Do ç . Dr. Deniz Dal)](https://reader037.vdocuments.pub/reader037/viewer/2022102510/5681405c550346895dabce21/html5/thumbnails/1.jpg)
BM-104
Nesneye Yönelik Programlama
Bahar 2013
(6. Sunu)
(Yrd. Doç. Dr. Deniz Dal)
![Page 2: BM-104 Nesneye Yönelik Programlama Bahar 201 3 ( 6 . Sunu ) ( Yrd . Do ç . Dr. Deniz Dal)](https://reader037.vdocuments.pub/reader037/viewer/2022102510/5681405c550346895dabce21/html5/thumbnails/2.jpg)
Kompozisyon (HAS-A Relationship)
Bir x sınıfının bir üye değişkeni bir başka y sınıfının bir nesnesi olabilir. (y HAS-A x)
Bu türden bir ilişkiye kompozisyon (composition) denir. Kompozisyon sayesinde küçük basit parçalardan daha sofistike bileşenler elde edebiliriz.
![Page 3: BM-104 Nesneye Yönelik Programlama Bahar 201 3 ( 6 . Sunu ) ( Yrd . Do ç . Dr. Deniz Dal)](https://reader037.vdocuments.pub/reader037/viewer/2022102510/5681405c550346895dabce21/html5/thumbnails/3.jpg)
![Page 4: BM-104 Nesneye Yönelik Programlama Bahar 201 3 ( 6 . Sunu ) ( Yrd . Do ç . Dr. Deniz Dal)](https://reader037.vdocuments.pub/reader037/viewer/2022102510/5681405c550346895dabce21/html5/thumbnails/4.jpg)
![Page 5: BM-104 Nesneye Yönelik Programlama Bahar 201 3 ( 6 . Sunu ) ( Yrd . Do ç . Dr. Deniz Dal)](https://reader037.vdocuments.pub/reader037/viewer/2022102510/5681405c550346895dabce21/html5/thumbnails/5.jpg)
![Page 6: BM-104 Nesneye Yönelik Programlama Bahar 201 3 ( 6 . Sunu ) ( Yrd . Do ç . Dr. Deniz Dal)](https://reader037.vdocuments.pub/reader037/viewer/2022102510/5681405c550346895dabce21/html5/thumbnails/6.jpg)
![Page 7: BM-104 Nesneye Yönelik Programlama Bahar 201 3 ( 6 . Sunu ) ( Yrd . Do ç . Dr. Deniz Dal)](https://reader037.vdocuments.pub/reader037/viewer/2022102510/5681405c550346895dabce21/html5/thumbnails/7.jpg)
![Page 8: BM-104 Nesneye Yönelik Programlama Bahar 201 3 ( 6 . Sunu ) ( Yrd . Do ç . Dr. Deniz Dal)](https://reader037.vdocuments.pub/reader037/viewer/2022102510/5681405c550346895dabce21/html5/thumbnails/8.jpg)
Atama operatörü int atamalarında farklı bir anlam, nesne atamalarında daha farklı bir anlam taşır. İleriki derslerimizde atama operatörünü aşırı yükleyeceğiz. (Operator Overloading) (Polymorfism nedir?)
![Page 9: BM-104 Nesneye Yönelik Programlama Bahar 201 3 ( 6 . Sunu ) ( Yrd . Do ç . Dr. Deniz Dal)](https://reader037.vdocuments.pub/reader037/viewer/2022102510/5681405c550346895dabce21/html5/thumbnails/9.jpg)
![Page 10: BM-104 Nesneye Yönelik Programlama Bahar 201 3 ( 6 . Sunu ) ( Yrd . Do ç . Dr. Deniz Dal)](https://reader037.vdocuments.pub/reader037/viewer/2022102510/5681405c550346895dabce21/html5/thumbnails/10.jpg)
![Page 11: BM-104 Nesneye Yönelik Programlama Bahar 201 3 ( 6 . Sunu ) ( Yrd . Do ç . Dr. Deniz Dal)](https://reader037.vdocuments.pub/reader037/viewer/2022102510/5681405c550346895dabce21/html5/thumbnails/11.jpg)
Başka Bir Kompozisyon Örneği
![Page 12: BM-104 Nesneye Yönelik Programlama Bahar 201 3 ( 6 . Sunu ) ( Yrd . Do ç . Dr. Deniz Dal)](https://reader037.vdocuments.pub/reader037/viewer/2022102510/5681405c550346895dabce21/html5/thumbnails/12.jpg)
Kalıtım/Miras (is-a Relationship)
Bir y sınıfı bir x sınıfının tüm üye değişkenleri ve üye fonksiyonlarına ek/ilave olarak başka niteliklere ve davranışlara sahip olabilir. (y IS-A x)
Bu türden bir ilişkiye kalıtım/miras (inheritance) denir. Bu durumda x temel sınıf (base class) ve y türetilmiş sınıf (derived class) olarak adlandırılır. (Her y bir x’tir ama her x bir y değildir.)
Kalıtım sayesinde daha önceden yazılmış bir kodun yeniden kullanılması sağlanır ve kopyala yapıştıra gerek kalmaz.
![Page 13: BM-104 Nesneye Yönelik Programlama Bahar 201 3 ( 6 . Sunu ) ( Yrd . Do ç . Dr. Deniz Dal)](https://reader037.vdocuments.pub/reader037/viewer/2022102510/5681405c550346895dabce21/html5/thumbnails/13.jpg)
![Page 14: BM-104 Nesneye Yönelik Programlama Bahar 201 3 ( 6 . Sunu ) ( Yrd . Do ç . Dr. Deniz Dal)](https://reader037.vdocuments.pub/reader037/viewer/2022102510/5681405c550346895dabce21/html5/thumbnails/14.jpg)
![Page 15: BM-104 Nesneye Yönelik Programlama Bahar 201 3 ( 6 . Sunu ) ( Yrd . Do ç . Dr. Deniz Dal)](https://reader037.vdocuments.pub/reader037/viewer/2022102510/5681405c550346895dabce21/html5/thumbnails/15.jpg)
![Page 16: BM-104 Nesneye Yönelik Programlama Bahar 201 3 ( 6 . Sunu ) ( Yrd . Do ç . Dr. Deniz Dal)](https://reader037.vdocuments.pub/reader037/viewer/2022102510/5681405c550346895dabce21/html5/thumbnails/16.jpg)
Kalıtım sayesinde kopyala yapıştır ile yeni bir sınıf oluşturmak yerine var olan bir sınıfa yeni üye değişkenler ve/veya üye fonksiyonlar ekleyerek daha kompakt programlar oluştururuz. Bu sayede daha genel bir tanımı daha özel bir hale dönüştürürüz.
![Page 17: BM-104 Nesneye Yönelik Programlama Bahar 201 3 ( 6 . Sunu ) ( Yrd . Do ç . Dr. Deniz Dal)](https://reader037.vdocuments.pub/reader037/viewer/2022102510/5681405c550346895dabce21/html5/thumbnails/17.jpg)
![Page 18: BM-104 Nesneye Yönelik Programlama Bahar 201 3 ( 6 . Sunu ) ( Yrd . Do ç . Dr. Deniz Dal)](https://reader037.vdocuments.pub/reader037/viewer/2022102510/5681405c550346895dabce21/html5/thumbnails/18.jpg)
Her Dikdortgen bir Sekil’dir.
![Page 19: BM-104 Nesneye Yönelik Programlama Bahar 201 3 ( 6 . Sunu ) ( Yrd . Do ç . Dr. Deniz Dal)](https://reader037.vdocuments.pub/reader037/viewer/2022102510/5681405c550346895dabce21/html5/thumbnails/19.jpg)
![Page 20: BM-104 Nesneye Yönelik Programlama Bahar 201 3 ( 6 . Sunu ) ( Yrd . Do ç . Dr. Deniz Dal)](https://reader037.vdocuments.pub/reader037/viewer/2022102510/5681405c550346895dabce21/html5/thumbnails/20.jpg)
Kim Kime Ulaşabilir?
![Page 21: BM-104 Nesneye Yönelik Programlama Bahar 201 3 ( 6 . Sunu ) ( Yrd . Do ç . Dr. Deniz Dal)](https://reader037.vdocuments.pub/reader037/viewer/2022102510/5681405c550346895dabce21/html5/thumbnails/21.jpg)
Dikdortgen Sınıfından DikdorgenlerPrizmasi Sınıfını Kalıtım Yoluyla Siz Oluşturunuz.
(yukseklik Üye Değişkeni ile Hacim Hesaplayan Üye Fonksiyonu Yeni Sınıfınıza Eklemeyi
Unutmayınız.)