13.3 Relationships Among Objects in an Inheritance Hierarchy
|
|
|
- Duygu Gökçe
- 10 yıl önce
- İzleme sayısı:
Transkript
1 Chapter13 We now continue our study of OOP by explaining and demonstrating polymorphism with inheritance hierarchies. Polymorphism enables you to program in the general rather than program in the specific. In particular, polymorphism enables you to write programs that process objects of classes that are part of the same class hierarchy as if they were all objects of the hierarchy s base class. (OOP çalışmamıza şuradan devam edeceğiz: Inheritance hiyerarşisi ile polymorphism i açıklayacağız, göstereceğiz.) 13.3 Relationships Among Objects in an Inheritance Hierarchy Invoking Base-Class Functions from Derived-Class Objects The example demonstrates three ways to aim base and derived-class pointers at base and derived-class objects. The first two are straightforward we aim a base-class pointer at a base-class object and invoke base class functionality, and we aim a derived-class pointer at a derived-class object and invoke derived-class functionality. ( base ve derived-class object lere, base ve derived-class pointer lar ile ilgili 3 farklı yol gösterilmiştir bu örnekte. İlk ikisi straightforward dır, bunlardan birincisinde base-class object e base class pointer point eder, dolayısıyla base class functionality invoke edilir. Bunlardan ikincisinde ise derived class object e derived class pointer point eder, dolayısıyla derived class functionality invoke edilir. ) Then, we demonstrate the relationship between derived classes and base classes (i.e., the is-a relationship of inheritance) by aiming a base-class pointer at a derived-class object and showing that the base-class functionality is indeed available in the derived-class object. ( üçüncüsünde ise, derived class lar ve base class lar arasındaki ilişki gösterilir, derived class object e base class pointer point eder, dolayısıyla derived class object de base class functionality yi kullanmak mümkündür. ) Recall that each BasePlusCommissionEmployee object is a CommissionEmployee that also has a base salary. (Herbir BasePlusCommissionEmployee object i bir CommissionEmployee object idir. Chapter12 de bunların header file ları da verilmişti.)
2 1 - CommissionEmployee object is created. 2- a pointer to this class is created. 1 - BasePlusCommissionEm ployee object is created. 2 - a pointer to this class is created. Derived class pointer a, derived class object in adresi assign edilir. Bu pointer invoke edilince, derived class-daki print fonksiyonu çağırılır. (Lines ) Base class pointer a, base class object in adresi assign edilir. Bu pointer invoke edilince, base classdaki print fonksiyonu çağırılır.(lines 36-39)
3 Yukarıdaki programın output ı aşağıdaki gibidir: Aiming a Base-Class Pointer at a Derived-Class Object Line 49 then assigns the address of derived-class object basepluscommissionemployee to base-class pointer commissionemployeeptr, which line 53 uses to invoke member function print. This crossover is allowed because an object of a derived class is an object of its base class.
4 ( 49. satırda, base class pointer(commissionemployeeptr) a, derived class object in adresi assign ediliyor. 53. Satırda, member function print() çağırılıyor. Burada çağırılan print() base class ın member function ı olan print dir. Bu crossover a izin verilir, çünkü derived class ın bir object i aynı zamanda base class ın da bir object idir. ) Despite the fact that the base class CommissionEmployee pointer points to a derived class BasePlusCommissionEmployee object, the base class CommissionEmployee s print member function is invoked (rather than BasePlusCommissionEmployee s print function). ( base-class pointer ı, derived class object e point etmesine rağmen, base class ın print() member fonksiyonu çağırılır. ) The output of each print member-function invocation in this program reveals that the invoked functionality depends on the type of the pointer (or reference) used to invoke the function, not the type of the object for which the member function is called. ( Invoke edilen(çağırılan) fonksiyon, pointer ın(veya reference ın) type ına bağlıdır, pointer ın point ettiği object in type ına bağlı değildir. ) In Section , when we introduce virtual functions, we demonstrate that it s possible to invoke the object type s functionality, rather than invoke the handle type s functionality. We ll see that this is crucial to implementing polymorphic behavior the key topic of this chapter. ( Şimdiye kadar öğrendiklerimizle handle type ının functionality sini çağırabiliyoruz bahsettiğimiz gibi. Yani handle type neymiş? Pointer ın type ıymış. Section de virtual fonksiyonları öğrendiğimizde, object type ının functionality sini invoke etmeyi(çağırmayı) öğreneceğiz. Bunu öğrenmek polymorphism fikrini anlamamız için çok önemli bir adım olacak, bu chapter ın ana fikri, en önemli kısmı öğrenilmiş olunacak. ) Aiming Derived-Class Pointers at Base-Class Objects In Section , we assigned the address of a derived-class object to a base-class pointer and explained that the C++ compiler allows this assignment, because a derived-class object is a base-class object. We take the opposite approach in Fig. 13.2, as we aim a derived-class pointer at a base-class object.
5 ( Bir önceki section da ne yapmıştık? Base class pointer a, derived class object in adresini assign etmiştik, ve C++ compiler ın bu assignment a izin verdiğini açıklamıştık, çünkü derived class object in aynı zamanda bir base-class object olduğunu söylemiştik. Aşağıda, Figure 13.2 de, bu yaklaşımın tam tersini uyguladık, yani derived class pointer a, base class object in adresini verdik. ) Lines 8 9 of Fig create a CommissionEmployee object, and line 10 creates a BasePlusCommissionEmployee pointer. ( Figure13.2 de, Satırlarda CommissionEmployee object create edilir. 10 satırda BasePlusCommissionEmployee pointer ı create edilir. ) Line 14 attempts to assign the address of base-class object commissionemployee to derived-class pointer basepluscommissionemployeeptr, but the compiler generates an error. ( 14. Satırda, base class object in adresi, derived class pointer a assign edilir. Ama compiler error generate eder. Neyi neye assign edebilirsin şöyle açıklayayım da aklında kalsın. Pointer ın type ına bakarsın. Pointer ın type ına uygun bir şey assign etmelisin pointer a. Mesela base class pointer olsun. Bu pointer a bir adres i assign edeceğiz ya hani, işte bu adres doğru olmalı, bu adres base class object in adresi de olabilir, derived class object in adresi de. Sonuç da her ikisi de base class ın object idirler hiyerarşide. Ancak derived class pointer a, base class object in adresini veremeyiz. Mesela Mercedes* = CarObject diyemeyiz, çünkü derived class pointer a assign edeceğimiz adres, pointer type ına uygun olmalıdır, diğer bir deyişle is a relationship olmalıdır. CarObject is not Mercedes. Dolayısıyla bu assignment olmaz. ) The compiler prevents this assignment, because a CommissionEmployee is not a BasePlusCommissionEmployee. ( Compiler bu assignment ı engeller, bu assignment a izin vermez. Çünkü CommissionEmployee object i, BasePlusCommissionEmployee object i değildir, yani base class object i, derived class object i değildir. Bunun tersi doğru olduğu için, bir önceki section daki assignment a izin veriliyordu. ) Consider the consequences if the compiler were to allow this assignment. Through a BasePlusCommissionEmployee pointer, we can invoke every BasePlusCommissionEmployee
6 member function, including setbasesalary, for the object to which the pointer points (i.e., the base-class object commissionemployee). ( Compiler eğer bu assignment a izin verseydi, bunun olası sonuçları ne olurdu düşünelim. Derived class pointer ı aracılığıyla, derived class ın tüm member function ları (setbasesalary() fonksiyonu da dahil, ki bu fonksiyon pointer ın point ettiği object için çağırılır.) çağırılabilir. ) However, the CommissionEmployee object does not provide a setbasesalary member function, nor does it provide a basesalary data member to set. This could lead to problems, because member function setbasesalary would assume that there is a basesalary data member to set at its usual location in a BasePlusCommissionEmployee object. This memory does not belong to the CommissionEmployee object, so member function setbasesalary might overwrite other important data in memory, possibly data that belongs to a different object. ( Ancak, CommissionEmployee object, setbasesalary() member function ı provide etmez, basesalary isimli member data da provide etmez hatta. Bu member function ve member data sadece derived class da vardır yani. Bu da problemlere neden olabilir, çünkü setbasesalary member function ı, basesalary isimli bir data member ın varolduğunu assume eder, peki bu data member ın nerede olduğunu assume eder, olağan location ında, BasePlusCommissionEmployee object inde olduğunu assume eder. Böyle bir memory(basesalary), CommissionEmployee object nde yoktur, dolayısıyla setbasesalary isimli member function memory daki önemli dataların üzerine overwrite edebilir, muhtemelen farklı bir object in data sı üzerine overwrite eder.)
7 Derived-Class Member-Function Calls via Base-Class Pointers Off a base-class pointer, the compiler allows us to invoke only baseclass member functions. Thus, if a base-class pointer is aimed at a derivedclass object, and an attempt is made to access a derived-class-only member function, a compilation error will occur. ( base class pointer aracılığıyla, sadece base-class member function ların çağırılmasına izin verir compiler. Dolayısıyla, base class pointer, derived class object e point ederse ve derived-class-only member function a erişilmeye çalışılırsa, compilation error olur. Yani derived class da olup, base class da olmayan bir member function a erişilmeye çalışılırsa eğer, compilation error olur. ) Figure 13.3 shows the consequences of attempting to invoke a derived-class member function off a base-class pointer. Line 14 aims commissionemployeeptr at derived-class object basepluscommissionemployee. Recall from Section that this is allowed, because a BasePlusCommissionEmployee is a CommissionEmployee (in the sense that a
8 BasePlusCommissionEmployee object contains all the functionality of a CommissionEmployee object). Lines invoke base-class member functions getfirstname, getlastname, getsocialsecuritynumber, getgrosssales and getcommissionrate off the base-class pointer. All of these calls are legitimate, because BasePlusCommissionEmployee inherits these member functions from CommissionEmployee. ( Figure 13.3 şunu gösterir : base class pointer aracılığıyla, derived class member function ı invoke etme girişimlerinin sonuçlarını gösterir. 14. Satırda, base class pointer, derived class object e point ediyor. Hatırlayalım, compiler buna izin verir. 18. Ve 22. Satırlarda, base-class pointer aracılığıyla, base-class member function lar çağırılır. Bu call ların hepsi yasaldır, çünkü derived class, tüm bu member function ları base class dan miras alır. ) We know that commissionemployeeptr is aimed at a BasePlusCommissionEmployee object, so in lines we attempt to invoke BasePlusCommissionEmployee member functions getbasesalary and setbasesalary. The compiler generates errors on both of these calls, because they re not made to member functions of base-class CommissionEmployee. ( Base class pointer(commissionemployeeptr) a, derived class object in adresini assign etmiştik. 26. Ve 27. Satırlarda, base-class pointer aracılığıyla derived-class member function lardan ikisini yani getbasesalary ve setbasesalary fonksiyonlarını invoke etme girişiminde bulunuyoruz. Bu function call ların herbirisi için, compiler error generate eder, çünkü invoke edilen function lar(getbasesalary, setbasesalary) CommissionEmployee base class ının member fonksiyonları değildirler. ) The handle can be used to invoke only those functions that are members of that handle s associated class type. (In this case, off a CommissionEmployee *, we can invoke only CommissionEmployee member functions setfirstname, getfirstname, setlastname, getlastname, setsocialsecuritynumber, getsocialsecuritynumber, setgrosssales, getgrosssales, setcommissionrate, getcommissionrate, earnings and print. ( Handle neydi? Pointer dı. Handle sadece kendisinin type ı ile ilişkili class type larının member function larını invoke etmek için kullanılabilir. Bu örnekte, CommissionEmployee *(base class dır bu) sadece şu CommissionEmployee member function larını invoke edebiliriz: setfirstname, getfirstname, setlastname, getlastname,
9 setsocialsecuritynumber, getsocialsecuritynumber, setgrosssales, getgrosssales, setcommissionrate, getcommissionrate, earnings and print. ) The compiler will allow access to derived-class-only members from a base-class pointer that s aimed at a derived-class object if we explicitly cast the base-class pointer to a derived-class pointer this is known as downcasting.
10 ( Eğer şöyle yaparsak, compiler, derived class object e point eden bir base class pointer aracılığıyla derived-class-only member lara erişmemize izin verir : base class pointer ı, bir derived class pointer a explicitly cast edersek, bu işleme downcasting denir. ) As you know, it s possible to aim a base-class pointer at a derived-class object. However, as we demonstrated in Fig. 13.3, a base-class pointer can be used to invoke only the functions declared in the base class. Downcasting allows a derived-class-specific operation on a derived-class object pointed to by a base-class pointer. After a downcast, the program can invoke derived-class functions that are not in the base class. Downcasting is a potentially dangerous operation. Section 13.8 demonstrates how to safely use downcasting. ( Bildiğiniz gibi, base class pointer ın, derived class pointer a point etmesi mümkündür. Ancak, Figure 13.3 de de gösterildiği gibi, bir base-class pointer sadece baseclass da declare edilmiş olan fonksiyonları invoke etmek için kullanılır. Downcasting ise şuna izin verir : base-class pointer ın point ettiği bir derived-class object de, derived-class-specific operation gerçekleştirilmesine izin verir. Downcast yapıldıktan sonra, program, base-class da olmayan derived-class fonksiyonlarını invoke edebilir. Downcasting yapmak tehlikeli bir iştir. Section 13.8 de güvenli bir şekilde nasıl downcast yapılabileceğini öğreneceğiz. ) Software Engineering Observation 13.3 If the address of a derived-class object has been assigned to a pointer of one of its direct or indirect base classes, it s acceptable to cast that base-class pointer back to a pointer of the derived-class type. In fact, this must be done to send that derived-class object messages that do not appear in the base class. ( Bir derived class object in adresi, bu class ın direct veya indirect base class larından birine pointer a assign edilirse eğer, bu base class pointer ı derived-class type ına cast etmek uygundur. Aslında, base-class da olmayan derived-class'da olan fonksiyonlarını çağırmak için bu yapılmak zorundadır. ) Virtual Functions In Section , we aimed a base-class CommissionEmployee pointer at a derivedclass BasePlusCommissionEmployee object, then invoked member function print through that pointer. Recall that the type of the handle determined which class s functionality to invoke section'da base class pointer'ı derived class object'e point ettirmiştik. Sonra bu pointer aracılığıyla print member fonksiyonunu invoke etmiştik. Hatırlayalım, hangi class'ın fonksiyonunun invoke edileceğini, handle(pointer) type belirliyordu.
11 In that case, the CommissionEmployee pointer invoked the CommissionEmployee member function print on the BasePlusCommissionEmployee object, even though the pointer was aimed at a BasePlusCommissionEmployee object that has its own custom print function. ( Bu durumda, CommissionEmployee(base class) pointer, CommissionEmployee(base class) class'ının member function'ı olan print()'i, BasePlusCommissionEmployee(derived class) object'i üzerinde çağırır, pointer'ın point ettiği BasePlusCommissionEmployee object'inin kendi print fonksiyonu olmasına rağmen, bu print fonksiyonu çağırılmaz. ) Software Engineering Observation 13.4 With virtual functions, the type of the object, not the type of the handle used to invoke the member function, determines which version of a virtual function to invoke. ( virtual fonksiyonlar kullanırsak, hangi virtual function versiyonunun invoke edileceğini, handle'ın type değil, object'in type'ı belirler. ) First, we consider why virtual functions are useful. Suppose that shape classes such as Circle, Triangle, Rectangle and Square are all derived from base class Shape. Önce virtual fonksiyonların neden yararlı olduklarını tartışalım. Circle class'ından şu class'ların derive ettiğini(türediğini) düşünelim : Circle, Triangle, Rectangle and Square. Each of these classes might be endowed with the ability to draw itself via a member function draw. Although each class has its own draw function, the function for each shape is quite different. ( Bu class'ların herbiri kendilerini çizecek draw fonksiyonuna sahiptirler. ) In a program that draws a set of shapes, it would be useful to be able to treat all the shapes generically as objects of the base class Shape. ( Birçok shape çizen bir program düşünelim. Tüm shape'leri, base class Shape'in object'leri gibi düşünmek yararlıdır. ) Then, to draw any shape, we could simply use a base-class Shape pointer to invoke function draw and let the program determine dynamically (i.e., at runtime) which derivedclass draw function to use, based on the type of the object to which the base-class Shape pointer points at any given time.
12 ( Sonra, herhangi bir shape çizmek için, base-class(shape) pointer kullanabiliriz. Bu pointer'a hangi derived class type'ındaki object'in adresi assign edilirse, o derived class'ın draw fonksiyonu invoke edilir(çağırılır). Hangi derived class'ın draw fonksiyonunun çağırılacağına run-time'da karar verir programımız. Diğer bir deyişle, dynamically belirlenir hangi draw fonksiyonunun çağırılacağı. ) To enable this behavior, we declare draw in the base class as a virtual function, and we override draw in each of the derived classes to draw the appropriate shape. From an implementation perspective, overriding a function is no different than redefining one (which is the approach we ve been using until now). ( Bu behaviour'u enable etmek için, base-class'daki draw fonksiyonunu virtaul fonksiyon olarak declare ederiz. Ve herbir derived class'daki draw fonksiyonunu override ederiz. ) An overridden function in a derived class has the same signature and return type (i.e., prototype) as the function it overrides in its base class. ( Derived class'daki overridden function, base-class'daki override edilen function ile aynı signature ve return type'a sahip olmalıdır. ) If we do not declare the base-class function as virtual, we can redefine that function. By contrast, if we declare the base-class function as virtual, we can override that function to enable polymorphic behavior. We declare a virtual function by preceding the function s prototype with the keyword virtual in the base class. ( Base class function'ı virtual olarak declare etmezsek eğer, bu function'ı redefine edebiliriz. Ancak, base class function'ı virtual olarak declare edersek eğer, polymorphic behaviour'ı enable etmek için bu function'ı override edebiliriz. Virtual function nasıl declare edilir, base class'daki function'ın prototype'ının önüne virtual keyword'ünü getirerek. ) For example, virtual void draw() const; would appear in base class Shape. The preceding prototype declares that function draw is a virtual function that takes no arguments and returns nothing. This function is declared const
13 because a draw function typically would not make changes to the Shape object on which it s invoked virtual functions do not have to be const functions. (Örneğin base class Shape'deki virtual draw fonksiyonu böyle declare edilir. Bu fonksiyon, const olarak declare edilmiştir, çünkü draw fonksiyonu, içerisinden invoke edildiği object'i değiştirmez, modify etmez. Ancak virtual fonksiyonlar const function olmak zorunda değildir. ) Software Engineering Observation 13.5 Once a function is declared virtual, it remains virtual all the way down the inheritance hierarchy from that point, even if that function is not explicitly declared virtual when derived class overrides it. ( Bir function virtual olarak declare edilince, bu noktadan itibaren inheritance hiyerarşisinde aşağıya doğru virtual'dır. derived class, base class'daki virtual fonksiyonu override ederken explicity virtual declare edilmese bile. ) Good Programming Practice 13.1 Even though certain functions are implicitly virtual because of a declaration made higher in the class hierarchy, explicitly declare these functions virtual at every level of the class hierarchy to promote program clarity. ( Bazı fonksiyonlar implicitly virtual'durlar, çünkü class hiyerarşisinde üstlerde(base class'larda) virtual declaration explicitly yapılmıştır. Ancak, program'ın daha clear olması için, bu fonksiyonlar tüm aşamalarda explicit bir şekilde virtual keyword ile declare edilmelidirler. Yani base class'da virtual draw fonksiyonu var diyelim. Bu class'ın derived class'larında draw methodu yazarsak, bu methodun signature'ının başına virtual keywordünü koymasak bile bu fonksiyon virtual'dır. Ancak bu fonksiyonların başına virtual keyword'ünü koymak iyi bir alışkanlık olacaktır, daha clear,temiz,net bir program olacaktır, kodumuzu okuyanlar kolaylıkla takip edebilecektir. ) Error-Prevention Tip 13.1 When you browse a class hierarchy to locate a class to reuse, it s possible that a function in that class will exhibit virtual function behavior even though it isn t explicitly declared virtual. This happens when the class inherits a virtual function from its base class, and it can lead to subtle logic errors. Such errors can be avoided by explicitly declaring all virtual functions virtual throughout the inheritance hierarchy.
14 ( Mesela, derived class'da draw methodunu tanımlarken şuna dikkat et. Bu class'ın base class'larında draw methodu virtual olarak declare edilmiş olabilir, dolayısıyla bizim class'ımızdaki draw methodu da implicit bir şekilde virtual'dır. Dolayısıyla base class'daki draw donksiyonunun virtual olduğunu bilmezsek, problem olabilir. Bu yüzden class'ımızın miras aldığı fonksiyonları bilmeli ve buna göre hareket etmeliyiz. Bu gibi error'ları önlemek için class hiyerarşisindeki tüm virtual fonksiyonları explicit bir şekilde virtual keyword'ü ile declare etmeliyiz. ) Software Engineering Observation 13.6 When a derived class chooses not to override a virtual function from its base class, the derived class simply inherits its base class s virtual function implementation. ( Derived class, base class'daki bir virtual fonksiyon'u override etmek zorunda değildir. Override etmeyebilir, bu durumda base class'ın virtual function implementation'ı derived class'a miras yoluyla aktarılır. ) If a program invokes a virtual function through a base-class pointer to a derivedclass object (e.g., shapeptr->draw()) or a base-class reference to a derived-class object (e.g., shaperef.draw()), the program will choose the correct derived-class draw function dynamically (i.e., at execution time) based on the object type not the pointer or reference type. Choosing the appropriate function to call at execution time (rather than at compile time) is known as dynamic binding or late binding. ( derived class object'e point eden bir base-class pointer aracılığıyla, virtual function invoke edilirse, veya derived class object'e refer eden bir base-class reference aracılığıyla virtual function invoke edilirse, program pointer veya reference type'ına göre değil, object'in type'ına göre doğru derived class'ın draw fonksiyonunu dynamically seçer. Execute edilecek fonksiyonun, execution time'da belirlenmesi işlemine dynamic binding veya late binding denir. ) When a virtual function is called by referencing a specific object by name and using the dot member-selection operator (e.g., squareobject.draw()), the function invocation is resolved at compile time (this is called static binding) and the virtual function that s called is the one defined for (or inherited by) the class of that particular object this is not polymorphic behavior.?????????*
15 ( Specific bir object'in ismi ve dot operator kullanılarak, bir virtual function reference edilerek çağırıldığında(mesela squareobject.draw(), hangi fonksiyonun invoke edileceğine compile time'da karar verilir. Buna da static binding denir. Invoke edilen virtual function, specific object'imizin veya bu objecrt'imizin fonksiyonudur, veya bu object'imizin derived class'larının bir fonksiyonudur. ) Thus, dynamic binding with virtual functions occurs only off pointer (and, as we ll soon see, reference) handles. ( Virtual fonksiyonlar kullanırken gerçekleşen dynamic binding sadece pointer handle'lar ile mümkündür. Reference handle'lar ile de mümkündür, bunu da yakında göreceğiz. ) Now let s see how virtual functions can enable polymorphic behavior in our employee hierarchy. Figures are the headers for classes CommissionEmployee and BasePlusCommissionEmployee, respectively. The only new features in these files is that we specify each class s earnings and print member functions as virtual (lines of Fig and lines of Fig. 13.5). Because functions earnings and print are virtual in class CommissionEmployee, class BasePlusCommissionEmployee s earnings and print functions override class CommissionEmployee s. ( Employee class hiyerarşimizde, polymorphic behaviour'ı nasıl kullandığımızı öğrenelim şimdi de. Earnings ve print member function'ları virtual olarak declare edilmiştir. Bu file'lardaki tek değişen şey şu olmuştur: herbir class'ın earnings ve print member function'ları virtual olarak declare edilmiştir. Base class(commissionemployee)'daki earnings ve print member function'ları virtual olarak declare edilmiştir, dolayısıyla derived class(basepluscommissionemployee)'daki earnings ve print member function'ları, base class'ın correspoinding member function'larını override eder. ) Now, if we aim a base-class CommissionEmployee pointer at a derived-class BasePlusCommissionEmployee object, and the program uses that pointer to call either function earnings or print, the BasePlusCommissionEmployee object s corresponding function will be invoked. There were no changes to the member-function implementations of classes CommissionEmployee and BasePlusCommissionEmployee, so we reuse the versions of Figs and
16 ( base-class pointer, derived class object'e point ediyor, program bu pointer aracılığıyla earning veya print member function'larını invoke etmeye çalışınca, derived class'ın earning ve print member function'ları invoke ediliyor. 12. chapter'daki Figure ve 12.15'deki class'ların member implementation'ları değişiklik yapılmadan aşağıda gösterilmiştir: )
17 We modified Fig to create the program of Fig Lines demonstrate again that a CommissionEmployee pointer aimed at a CommissionEmployee object can be used to invoke CommissionEmployee functionality, and a BasePlusCommissionEmployee pointer aimed at a BasePlusCommissionEmployee object can be used to invoke BasePlusCommissionEmployee functionality. Line 54 aims the base-class pointer commissionemployeeptr at derived-class object basepluscommissionemployee. Note that when line 61 invokes member function print off the base-class pointer, the derived-class BasePlusCommissionEmployee s print member function is invoked, so line 61 outputs different text than line 53 does in Fig (when member function print was not declared virtual). We see that declaring a member function virtual causes the program to dynamically determine which function to invoke based on the type of object to which the handle points, rather than on the type of the handle. ( 54. Satırda, base class pointer, derived class object e point(aim) ediyor. 61. Satırda, base-class pointer aracılığıyla, print member functin invoke edilince, derived class ın print() member function ı invoke edilir, dolayısıyla bu programdaki 61. Satır ve Figure 13.1 deki 53. Satır farklı output lar verir. Bu program ve Figure13.1 deki program arasındaki fark şudur: bu programda print member function virtual olarak declare edilmiştir. Yani şunu görmüş oluruz programı çalıştırınca: Bir member function ı virtual olarak declare edersek, program handle ın type ına göre değil, handle ın point ettiği object in type ına göre hangi function ı çağıracağına dynamically karar verir. )
18 Note again that when commissionemployeeptr points to a CommissionEmployee object (line 40), class CommissionEmployee s print function is invoked, and when CommissionEmployeePtr points to a BasePlusCommissionEmployee object, class BasePlusCommissionEmployee s print function is invoked. ( CommissionEmployeePtr(base class), CommissionEmployee(base class) object e point ederse, CommissionEmployee nin print function ı invoke edilir. CommissionEmployeePtr(base class), BasePlusCommissionEmployee(base class) object e point ederse, BasePlusCommissionEmployee nin print function ı invoke edilir. ) Thus, the same message print, in this case sent (off a base-class pointer) to a variety of objects related by inheritance to that base class, takes on many forms this is polymorphic behavior. ( Dolayısıyla, farklı derived class lara point eden base-class pointer aracılığıyla invoke edilen print fonksiyonu farklı biçimler(formlar) alabilir. Bu da polymorphic behaviour olarak bilinir. )
19 Static binding in nasıl gerçekleştiğini inceleyelim.
20 13.4 Type Fields and switch Statements One way to determine the type of an object is to use a switch statement to check the value of a field in the object. This allows us to distinguish among object types, then invoke an appropriate action for a particular object. For example, in a hierarchy of shapes in which each shape object has a shapetype attribute, a switch statement could check the object s shapetype to determine which print function to call. ( Bir object in type ını saptamak için switch statement kullanılarak object deki bir field ın değeri check edilir. Bu sayede object type larını birbirinden ayırt edebiliriz, ve belli bir object için uygun olan bir action ı gerçekleştirebiliriz. Örneğin, herbir object in shapetype isimli bir attribute e sahip olduğu bir shape hiyerarşisinde, switch statement kullanılabilir,
21 hangi print function ın çağırılacağına object in shapetype attribute check edilerek karar verilebilir. ) Using switch logic exposes programs to a variety of potential problems. For example, you might forget to include a type test when one is warranted, or might forget to test all possible cases in a switch statement. When modifying a switch-based system by adding new types, you might forget to insert the new cases in all relevant switch statements. Every addition or deletion of a class requires the modification of every switch statement in the system; tracking these statements down can be time consuming and error prone. ( switch kullanmak şu olası problemlere yol açabilir: Örneğin, bazı type ları check edip, bazı type ları check etmeyi unutursak problem olur. Örneğin, yeni bir type implement ettikten sonra switch-based system i modify ederken, yeni case i tüm ilgili switch statement larına eklemeyi unutursak problem olur. Bir class ın eklenmesi veya silinmesi, sistemdeki tüm switch statement larını modify etmeyi gerektirir, bu statement ları takip etmek zaman alıcıdır ve hata yapma olasılığı yüksektir. ) Software Engineering Observation 13.7 Polymorphic programming can eliminate the need for switch logic. By using the polymorphism mechanism to perform the equivalent logic, you can avoid the kinds of errors typically associated with switch logic. ( Polymorphic programming switch logic e olan ihtiyacı ortadan kaldırır. Polymorphism mekanizması kullanarak, aynı mantığı uygulayabiliriz, ayrıca switchlogic deki muhtemel error ları da önlemiş oluruz. ) Software Engineering Observation 13.8 An interesting consequence of using polymorphism is that programs take on a simplified appearance. They contain less branching logic and simpler sequential code. This simplification facilitates testing, debugging and program maintenance. ( Polymorphism kullanmanın ilginç bir sonucu ise şudur : programlar daha sadeleştirilmiş, daha az komplex görünür. ) 13.5 Abstract Classes and Pure virtual Functions When we think of a class as a type, we assume that programs will create objects of that type. However, there are cases in which it s useful to define classes from which you never intend to instantiate any objects. Such classes are called abstract classes. Because these classes normally are used as base classes in inheritance hierarchies, we refer to them as abstract base classes. These classes cannot be used to instantiate objects, because, as we ll soon see, abstract classes are incomplete derived classes must define the missing pieces before objects of these classes can be instantiated. We build programs with abstract classes in Section 13.6.
22 ( Bir class ı bir type gibi düşünürsek, programların bu type dan bir object create edeceklerini assume ederiz. Ancak, kendisinden object create etmeyeceğimiz bazı class lar define etmek de isteyebiliriz bazen. Bu class lara abstract classes denir. Bu class lar inheritance hiyerarşisinde genelde base class olarak kullanıldıkları için, bu class lara abstract base classes da denir. Bu class lardan object instantiate edilemez(object create edilemez), çünkü abstract class lar incomplete dirler(tamamlanmamıştırlar),derived class lar bu eksik kısımları tamamlamalıdırlar ki bu class lardan object instantiate edilebilsin. ) Classes that can be used to instantiate objects are called concrete classes. Such classes define or inherit implementations for every member function they declare. We could have an abstract base class TwoDimensionalShape and derive such concrete classes as Square, Circle and Triangle. ( Kendisinden object create edilebilen class lara concrete class denir. Bu class lardaki declare edilen tüm fonksiyonlar define edilmiştirler, veya implementation ları miras almıştırlar. Örneğin, TwoDimensionalShape isimli bir abstract base class ımız olsun. Squrare, Circle ve Triangle isimli concrete class larımız olsun. ) Abstract base classes are too generic to define real objects; we need to be more specific before we can think of instantiating objects. -optional reading- For example, if someone tells you to draw the two-dimensional shape, what shape would you draw? Concrete classes provide the specifics that make it reasonable to instantiate objects. An inheritance hierarchy does not need to contain any abstract classes, but many object-oriented systems have class hierarchies headed by abstract base classes. In some cases, abstract classes constitute the top few levels of the hierarchy. A good example of this is the shape hierarchy in Fig. 12.3, which begins with abstract base class Shape. On the next level of the hierarchy we have two more abstract base classes TwoDimensionalShape and ThreeDimensionalShape. The next level of the hierarchy defines concrete classes for two-dimensional shapes (namely, Circle, Square and Triangle) and for three-dimensional shapes (namely, Sphere, Cube and Tetrahedron). -- Pure Virtual Functions A class is made abstract by declaring one or more of its virtual functions to be pure. A pure virtual function is specified by placing = 0 in its declaration, as in virtual void draw() const = 0; // pure virtual function The = 0 is a pure specifier. Pure virtual functions do not provide implementations. Every concrete derived class must override all base-class pure virtual functions with concrete implementations of those functions.
23 ( Bir class ın içerdiği virtual function ların biri pure yapılırsa, bu class abstract olur. Virtual bir function declare edilirken, =0 ile specify edersek, bu function, pure virtual function olur. Pure virtual function lar implement edilmemiştirler. Abstract base class dan concrete derived class create etmek istiyorsak, base-class daki pure virtual function ları derived class da override etmek zorundayız. ) The difference between a virtual function and a pure virtual function is that a virtual function has an implementation and gives the derived class the option of overriding the function; by contrast, a pure virtual function does not provide an implementation and requires the derived class to override the function for that derived class to be concrete; otherwise the derived class remains abstract. ( virtual function ve pure virtual function arasındaki fark nedir? Virtual function implement edilmiştir, dolayısıyla derived class bu function ı override etme ve etmeme seçeneğine sahiptir. Ancak pure virtual function, implementation a sahip değildir, object create edilebilen bir class(concrete class) ortaya çıkarmak için, base class daki pure virtual function override edilmek zorundadır(yani base class da implement edilmemiş, derived class da implement edilmek zorunda), aksi takdirde derived class da abstract class olarak kalır. ) Pure virtual functions are used when it does not make sense for the base class to have an implementation of a function, but you want all concrete derived classes to implement the function. Returning to our earlier example of space objects, it does not make sense for the base class SpaceObject to have an implementation for function draw (as there is no way to draw a generic space object without having more information about what type of space object is being drawn). An example of a function that would be defined as virtual (and not pure virtual) would be one that returns a name for the object. We can name a generic SpaceObject (for instance, as "space object"), so a default implementation for this function can be provided, and the function does not need to be pure virtual. The function is still declared virtual, however, because it s expected that derived classes will override this function to provide more specific names for the derived-class objects. ( Peki bir function ı neden pure virtual yapmak isteyelim? Veya neden virtual yapmak isteyelim? Base class daki bir fonksiyonu implement etmek mantıksız olacaktır mesela, pure virtual function kullanırız dolayısıyla, derived class larda da bu function ı implement etmek isteriz. Örneğin SpaceObject class ındaki draw fonksiyonunu implement etmek mantıksız olacaktır, çünkü şekli belli değil, ancak bu class ın derived class larında draw function ı implement etmek gerekecektir. Dolayısıyla SpaceObject class ındaki draw() fonksiyonu pure virtual olmalıdır, concrete derived class lar bunu overide etmelidirler. Mesela SpaceObject in ismini return eden fonksiyonu düşünelim. Her SpaceObject in bir ismi olacaktır mutlaka, base class da olsa, derived class da olsa. Dolayısıyla, pure virtual function değil, virtual function olacaktır bu. Ancak bu fonksiyon da gene virtual olarak declare edilmiştir, çünkü derived class object ler daha specific isimlere sahip oldukları için, derived class ların bu function ı overide etmeleri umulur. )
24 Software Engineering Observation 13.9 An abstract class defines a common public interface for the various classes in a class hierarchy. An abstract class contains one or more pure virtual functions that concrete derived classes must override. ( Bir abstract class, bir veya daha fazla pure virtual function içerir, concrete derived class'lar bu function'ları override etmek zorundadırlar. ) Common Programming Error 13.1 Failure to override a pure virtual function in a derived class makes that class abstract. Attempting to instantiate an object of an abstract class causes a compilation error. (derived class'da eğer pure virtual function'ı override etmezsek, bu class abstract olarak kalır. Abstract class'dan obje t instantiate etmeye çalışmak compilation error'a neden olur.) Software Engineering Observation An abstract class has at least one pure virtual function. An abstract class also can have data members and concrete functions (including constructors and destructors), which are subject to the normal rules of inheritance by derived classes. Although we cannot instantiate objects of an abstract base class, we can use the abstract base class to declare pointers and references that can refer to objects of any concrete classes derived from the abstract class. Programs typically use such pointers and references to manipulate derived-class objects polymorphically. ( Abstract base class type'ındaki bir pointer veya reference, bu class'dan derive etmiş bir concrete derived class'ın object'ine point edebilir. Derived class object'leri polymorphically manipulate etmek için, bu gibi pointer'lar ve reference'lar kullanılabilir. ) Device Drivers and Polymorphism An object-oriented operating system might use an abstract base class to provide an interface appropriate for all device drivers. Then, through inheritance from that abstract base class, derived classes are formed that all operate similarly. The capabilities (i.e., the public functions) offered by the device drivers are provided as pure virtual functions in the abstract base class. The implementations of these pure virtual functions are provided in the derived classes that correspond to the specific types of device drivers. This architecture also allows new devices to be added to a system easily, even after the operating system has been defined. The user can just plug in the device and install its new device driver. The operating system talks to this new device through its device driver, which has the same public member functions as all other device drivers - those defined in the device driver abstract base class. Object Oriented bir OS, tüm device driver'lar için uygun bir interface sağlamak amacıyla, abstract base class kullanır. Sonra inheritance aracılığıyla, bu abstract base class'dan derive eden class'lar da benzer şekilde çalışır. Device driver'lar tarafından sağlanan capability'ler, abstract base class'da pure virtual function'dırlar. Bu pure virtual function'ların implementation'ları derived class'larda sağlanır. Bu mimari sisteme yeni device'ların da
25 kolaylıkla eklenmesini sağlar. Kullanıcı sadece device'ı bağlar, ve yeni device driver'ı kolaylıkla install eder. Operating system bu yeni device ile, yüklenmiş olan device driver aracılığıyla konuşur. Bu device driver da diğer device driverlar ile aynı public member function'lara sahiptir, abstract base class'daki public member function'lar ile aynıdır. Iterators and Polymorphism It s common in object-oriented programming to define an iterator class that can traverse all the objects in a container (such as an array). For example, a program can print a list of objects in a vector by creating an iterator object, then using the iterator to obtain the next element of the list each time the iterator is called. ( Bir container(mesela array)'daki tüm object'leri traverse edebilecek bir iterator class define etmek oop'da sıklıkla yapılır. Örneğin, bir program, bir vector'deki object'lerin listesini print etmek isteyebilir. Bunun için bir iterator object create edip, bu iterator object'in her çağırılışında listedeki bir sonraki eleman obtain edilir(elde edilir). ) Iterators often are used in polymorphic programming to traverse an array or a linked list of pointers to objects from various levels of a hierarchy. The pointers in such a list are all base-class pointers. (Chapter 22, Standard Template Library (STL), presents a thorough treatment of iterators.) ( Polymorphic programlama'da iterator'lar şunlar için kullanılabilir : hiyerarşide farklı level'lerdeki object'lere pointer'ları içeren linked list veya array'leri traverse etmek için. Böyle bir listenin elemanları olan pointer'lar, base-class pointer'larıdır. ) A list of pointers to objects of the base class TwoDimensionalShape could contain pointers to objects of the classes Square, Circle, Triangle and so on. Using polymorphism to send a draw message, off a TwoDimensionalShape * pointer, to each object in the list would draw them correctly on the screen. ( Base class TwoDimensionalShape'in objectlerine pointer'ları içeren bir list, derived class'ların object'lerine pointer da içerebilir. Nasıl yani? ) 13.6 Case Study: Payroll System Using Polymorphism A company pays its employees weekly. The employees are of three types: Salaried employees : are paid a fixed weekly salary regardless of the number of hours worked, Commission employees : are paid a percentage of their sales, and Base-salary-plus-commission-employees : receive a base salary plus a percentage of their sales. For the current pay period, the company has decided to reward base-salary-pluscommission-employees by adding 10 percent to their base salaries. The company wants to implement a C++ program that performs its payroll calculations polymorphically. ( Bir şirket, çalışanlarının maaşlarını haftalık olarak ödüyor. 3 çeşit çalışan var :
26 Salaried employees : Bu çalışanlara sabit bir maaş ödenir. Çalıştıkları saat miktarına bakılmaksızın, maaşları sabittir. Commission employees : Bu çalışanlara, yaptıkları satışın belirli bir yüzdesi ödenir. Base-salary-plus-commission-employees: Sabit bir maaş + Satışın belirli bir yüzdesi. Şirket, Base-salary-plus-commission-employees type'ındaki çalışanları, sabit maaş kısmına yüzde 10 zam yaparak ödüllendirmeye karar veriyor. Şirket maaş hesaplamalarını polymorphically yapan bir C++ programı implement etmek istiyor. ) Aşağıdaki gibi bir class hieararchy inşaa ederiz. The abstract class name Employee is italicized, as per the convention of the UML. Abstract base class Employee declares the interface to the hierarchy that is, the set of member functions that a program can invoke on all Employee objects. Each employee, regardless of the way his or her earnings are calculated, has a first name, a last name and a social security number, so private data members firstname, lastname and socialsecuritynumber appear in abstract base class Employee. ( Tüm Employee object'lerinde invoke edilebilecek member function'lar, abstract base class Employee içinde declare edilir. BU class hiyerarşinin interface'ini declare eder. Çalışan type'ına bakılmaksızın, tüm çalışanlar şu data member'lara sahiptir : first name, a last name, a social security number. Dolayısıyla bu private data member'lar abstract base class Employee'de declare edilirler. ) Software Engineering Observation optional reading- A derived class can inherit interface and/or implementation from a base class. Hierarchies designed for implementation inheritance tend to have their functionality high in the hierarchy - each new derived class inherits one or more member functions that were
27 defined in a base class, and the derived class uses the base-class definitions. Hierarchies designed for interface inheritance tend to have their functionality lower in the hierarchy - a base class specifies one or more functions that should be defined for each class in the hierarchy (i.e., they have the same prototype), but the individual derived classes provide their own implementations of the function(s). -- The following sections implement the Employee class hierarchy. The first five each implement one of the abstract or concrete classes. The last section implements a test program that builds objects of all these classes and processes the objects polymorphically Creating Abstract Base Class Employee Class Employee provides functions earnings and print, in addition to various get and set functions that manipulate Employee s data members. An earnings function certainly applies generically to all employees, but each earnings calculation depends on the employee s class. So we declare earnings as pure virtual in base class Employee because a default implementation does not make sense for that function - there is not enough information to determine what amount earnings should return. Each derived class overrides earnings with an appropriate implementation. To calculate an employee s earnings, the program assigns the address of an employee s object to a base class Employee pointer, then invokes the earnings function on that object. ( Employee isimli abstract base class ımızı implement edelim. Earnings isimli function tüm employee lerde invoke edilebilir olmalıdır, ancak herbir farklı employee class için, farklı bir earning hesaplaması yapılmalıdır. Bu function, base class Employee de pure virtual olarak declare edilmelidir. Çünkü bu function için default implementation olması anlamsızdır. ) We maintain a vector of Employee pointers, each of which points to an Employee object. Of course, there cannot be Employee objects, because Employee is an abstract class because of inheritance, however, all objects of all derived classes of Employee may nevertheless be thought of as Employee objects. The program iterates through the vector and calls function earnings for each Employee object. C++ processes these function calls polymorphically. Including earnings as a pure virtual function in Employee forces every direct derived class of Employee that wishes to be a concrete class to override earnings. ( Employee pointer larından oluşan bir sağlıyoruz. Bu pointer lardan herbiri bir Employee object e point ediyor. Tabi Employee object e point ediyor derken şunu kastediyoruz aslında: Employee object var olamaz, Employee class ından object create edilemez. Çünkü Employee abstract bir class dır. Ama Employee class ının derived class larının object leri Employee object ler gibi düşünülebilir. Yani Employee pointer ları, Employee object lerine point ediyor derken, kastettiğimiz Employee object bu şekildedir. ) Function print in class Employee displays the first name, last name and social security number of the employee. As we ll see, each derived class of Employee overrides function print to output the employee s type (e.g., "salaried employee:") followed by the rest of
28 the employee s information. Function print in the derived classes could also call earnings, even though earnings is a pure-virtual function in base class Employee. (Employee class ındaki print function şunları gösterir : first name, last name and social security number of the employee. Employee class ının herbir derived class ı, bu print function ı override eder. Derived class lardaki print fonksiyonları, earnings fonksiyonunu çağırabilir; earning fonksiyonu, Employee base class da pure-virtual function diye declare edilmiş olmasına rağmen. ) ( Aşağıdaki diagrama bakalım. Hiyerarşimizdeki 4 class type sol tarafta yazılmıştır. Earnings ve print fonksiyonları üstte yazılmıştır. Herbir class için, herbir function ın desired result u gösterilmiştir bu diagram da. Employee class ı için =0 specify edilmiştir, yani bu function pure virtual dır ve implementation a sahip değildir(that this is a pure virtual function and hence has no implementation). Herbir derived class, bu function ı overrride edip, uygun implementation ı sağlar. Bu diagram da Employee class ının getter be setter function larını göstermeye ihtiyaç duymadık çünkü bu function lar derived class ların hiçbirinde override edilmemiştirler. Bu function lar, derived class lara miras yoluyla aynen aktarılmıştır. )
29 Employee Class Header (employee.h) Recall that we declared earnings as a pure virtual function because first we must know the specific Employee type to determine the appropriate earnings calculations. Declaring this function as pure virtual indicates that each concrete derived class must provide an earnings implementation and that a program can use base-class Employee pointers to invoke function earnings polymorphically for any type of Employee. ( earnings, pure virtual function dır, çünkü uygun earnings hesaplamasına karar vermek için önce specific Employee type ını bilmek zorundayız. Bu function ı pure virtual declare ettik ki, herbir concrete derived class earnings implementation ını provide etmek zorunda kalsın. Ayrıca programımız, base-class Employee pointer larını kullanarak, herhangi bir Employee type ının earnings fonksiyonunu polymorphically invoke edebilir(çağırabilir). )
30 Employee Class Member-Function Definitions Employee class ının member function larının implementation larını içerir aşağıdaki kod. Earnings isimli pure virtual function implement edilmez burada(no implementation is provided for virtual function earnings.). Print function virtual dır, pure virtual değildir, dolayısıyla, abstract base class Employee de implement edilmiştir. Derived class larda bu fonksiyon override edilecektir, ama edilmek zorunda değildir.
31 Creating Concrete Derived Class SalariedEmployee SalariedEmployee Class Member-Function Definitions ( Bu class ın constructor ı, Employee class ının constructor ına first name, last name ve social security number ı vererek base class dan miras yoluyla gelen bu private data member lar initialize edilir. Bu private data member lara, derived class dan doğrudan erişilemez. Earnings fonksiyonunu bu class da implement etmeseydik, bu class abstract olarak kalırdı. ) In class SalariedEmployee s header, we declared member functions earnings and print as virtual (lines of Fig ) - actually, placing the virtual keyword before these member functions is redundant. ( SalariedEmployee.h dosyasında, earnings ve print member function larını virtual olarak declare ettiğimiz için, SalariedEmployee.cpp dosyasında bu member function ların önüne virtual keyword ünü getirmek redundant(lüzumsuz,gereksiz,gerekenden fazla) dır. ) We defined them as virtual in base class Employee, so they remain virtual functions throughout the class hierarchy. Explicitly declaring such functions virtual at every level of the hierarchy can promote program clarity. Not declaring earnings as pure virtual signals our intent to provide an implementation in this concrete class. ( Bu fonksiyonları Employee base class da virtual olarak declare etmiştik. Dolayısıyla bu class lar class hiyerarşinde aşağıya doğru virtual olarak kalırlar. Bu dosyada tekrar virtual
32 olarak declare etmemizin nedeni, programımızın daha clear olması içindir. Bu dosyada pure virtual olarak değil, virtual olarak declare etmemiz, bu fonksiyonların implementation larını sağlayacağımızın bir işareti,sinyalidir. )
33 Function print of class SalariedEmployee (lines of Fig ) overrides Employee function print. If class SalariedEmployee did not override print, Salaried-Employee would inherit the Employee version of print function. ( SalariedEmployee class ının print function ı, Employee base class ının print fonksiyonunu override eder. Eğer SalariedEmployee class ı print fonksiyonunu overide etmeseydi, Employee class ının print fonksiyonu versiyonunu miras olarak alıp, kullanacaktı.) (41.satıra bak. Base-class Employee nin print function ı scope operator(::) kullanılarak, derived class ın print function ı içinden çağırılıyor, dikkatini ver ve incele. Güzel bir code reuse örneğidir bu.) Creating Concrete Derived Class CommissionEmployee Bu class ın constructor ı, Employee class ının constructor ına first name, last name ve social security number ı vererek base class dan miras yoluyla gelen bu private data member ları initialize eder.
34
35 Creating Indirect Concrete Derived Class BasePlusCommissionEmployee Class BasePlusCommissionEmployee directly inherits from class CommissionEmployee (line 8 of Fig ) and therefore is an indirect derived class of class Employee. (Bu class, CommissionEmployee class ından miras doğrudan miras alır. Bu yüzden, bu class, Employee class ının indirect(dolaylı) derived class ıdır. ) Line 35 in function earnings calls base-class CommissionEmployee s earnings function to calculate the commission-based portion of the employee s earnings. This is another nice example of code reuse. (35. satırda, earnings fonksiyonu çağırılınca, base-class CommissionEmployee nin earning fonksiyonu da çağırılarak employee nin earning i(kazancı) hesaplanır.) BasePlusCommissionEmployee s print initiates a chain of functions calls that spans all three levels of the Employee hierarchy. (bu class ın print fonksiyonu çağırılınca, Employee hiyerarşisinde her 3 seviyedeki class ların fonksiyonları zincirleme olarak çağırılır. )
36
37 Demonstrating Polymorphic Processing To test our Employee hierarchy, the program in Fig creates an object of each of the three concrete classes SalariedEmployee, CommissionEmployee and BasePlusCommissionEmployee. ( Employee hiyerarşimizi test etmek amacıyla, Figure13.17 deki program, 3 concrete class ın herbirinden bir object create eder. ) The program manipulates these objects, first with static binding, then polymorphically, using a vector of Employee pointers. (Programımız bu object leri, Employee pointer larını tutan bir vektör kullanarak manipulate eder. önce static binding kullanarak, sonra ise polymorphically manipulate eder. ) Lines create objects of each of the three concrete Employee derived classes. Lines output each Employee s information and earnings. Each member-function invocation in lines is an example of static binding at compile time, because we are using name handles (not pointers or references that could be set at execution time), the compiler can identify each object s type to determine which print and earnings functions are called. ( Satırlar arasında, 3 çeşit concrete Employee derived class ının herbirinden object ler create edilir Satırlar arasında, herbir Employee nin print ve earning fonksiyonları çağırılıp, output edilir satırlar arasındaki herbir member function invocation, static binding örneğidir. Execution time da set edilebilen pointer lar veya reference lar değil de, Name handles kullandığımız için, compiler hangi print veya earning fonksiyonunun çağırılacağını belirleyebilir. )
38
39 (41. satırda, employees isimli vektör e, 3 tane Employee pointer için memory den yer alınır. 44., 45. ve 46.satırlarda, concrete class lardan create etmiş olduğumuz object lerin adreslerini, Employee pointer lara assign ederiz. Compiler, Employee abstract class olmasına rağmen, bu assignment lara izin verir, çünkü adresi assign edilen object ler ve pointer ın type ı arasında is-a relationship vardır :
40 - SalariedEmployee is an Employee, - a CommissionEmployee is an Employee, and - a BasePlusCommissionEmployee is an Employee. ) The loop in lines traverses vector employees and invokes function virtualviapointer (lines 67 71) for each element in employees. ( Satırlardaki employees isimli vector traverse edilir, bu vektörün herbir elemanı için virtualviapointer fonksiyonu çağırılır. ) Function virtualviapointer receives in parameter baseclassptr the address stored in an employees element. Each call to virtualviapointer uses baseclassptr to invoke virtual functions print (line 69) and earnings (line 70). Function virtualviapointer does not contain any SalariedEmployee, CommissionEmployee or BasePlusCommissionEmployee type information. The function knows only about base-class type Employee. Therefore, the compiler cannot know which concrete class s functions to call through baseclassptr. Yet at execution time, each virtual-function invocation calls the function on the object to which baseclassptr points at that moment.all virtual function calls to print and earnings are resolved at runtime with dynamic binding. ( virtualviapointer fonksiyonu, parameter olarak baseclassptr alır. Bu parameter nedir peki? Employees isimli vektörün herbir elemanında store edilen adrestir. Peki ne yapar virtualviapointer fonksiyonu? baseclassptr yi kullanarak print ve earnings virtual fonksiyonlarını çağırır. virtualviapointer fonksiyonu, bizim 3 tane concrete derived class ımızın hiçbiri hakkında bir şey bilmez.bu fonksiyon sadece base-class type Employee yi bilir. Dolayısıyla compiler, baseclassptr aracılığıyla hangi concrete class ın fonksiyonlarını çağıracağını bilemez. Ancak execution time da, baseclassptr nin o anda point ettiği object in fonksiyonunun çağırılacağına karar verilir. Print ve earnings fonksiyonlarını çağırırken yapılan tüm virtual function call lar dynamic binding kullanılarak run-time da resolve edilir(çözümlenir). ) Finally, another for statement (lines 61 62) traverses employees and invokes function virtualviareference (lines 75 79) for each element in the vector. Function virtualviareference receives in its parameter baseclassref (of type const Employee &) a reference to the object obtained by dereferencing the pointer stored in each employees element (line 62). Each call to virtualviareference invokes virtual functions print (line 77) and earnings (line 78) via reference baseclassref to demonstrate that polymorphic processing occurs with base-class references as well. ( Son olarak, satırlarda, gene employee isimli vektörü traverse ederiz, ama bu sefer virtualviareference fonksiyonunu çağırırız.
41 Bu fonksiyon un parameter ı baseclassref dir. Bu parameter ın type ı şudur : const Employee &. Bu parameter nasıl elde edilir? Employees isimli vektörde store edilen herbir pointer dereference edilir, böylece object e reference elde edilmiş olunur. virtualviareference() fonksiyonu her çağırıldığında, baseclassref isimli reference aracılığıyla print ve earnings isimli virtual fonksiyonlar çağırılır. Burada da polymorphic processing gerçekleşir. Bu da bize base-class reference lar kullanılarak da polymorphism den yararlanılabileceğiniz gösterir. Hani chapter ın başında demiştik, hem pointer handle lar ile hem de reference handle lar ile polymorphism kullanılabilir, dynamic binding burada devreye girer demiştik. Şimdiye kadar hep pointer lar aracılığıyla polymorphism kullanmıştık, burada ise reference lar ile polymorphism kullanmayı da öğrendik çok şükür. ) Each virtual-function invocation calls the function on the object to which baseclassref refers at runtime. This is another example of dynamic binding. ( Bir virtual function invoke edildiğinde, baseclassref in refer ettiği object deki fonksiyon çağırılır. Bu run-time da olur. Bu, dynamic binding in önceki gördüklerimizden farklı bir örneğidir. ) The output produced using base-class references is identical to the output produced using base-class pointers. (base-class reference lar kullanılarak ve base-class pointer lar kullanılarak produce edilen output aynıdır. ) 13.7 (Optional) Polymorphism, Virtual Functions and Dynamic Binding Under the Hood C++ makes polymorphism easy to program. It s certainly possible to program for polymorphism in non-object-oriented languages such as C, but doing so requires complex and potentially dangerous pointer manipulations. This section discusses how C++ can implement polymorphism, virtual functions and dynamic binding internally. This will give you a solid understanding of how these capabilities really work. More importantly, it will help you appreciate the overhead of polymorphism in terms of additional memory consumption and processor time. This will help you determine when to use polymorphism and when to avoid it. As you ll see in Chapter 22, the STL components were implemented without polymorphism and virtual functions this was done to avoid the associated execution-time overhead and achieve optimal performance to meet the unique requirements of the STL. First, we ll explain the data structures that the compiler builds at compile time to support polymorphism at execution time. You ll see that polymorphism is accomplished
42 through three levels of pointers, i.e., triple indirection. Then we ll show how an executing program uses these data structures to execute virtual functions and achieve the dynamic binding associated with polymorphism. ( 1 Execution time'da polimorphism'i support etmek için, compiler'ın compile time'da inşaa ettiği data structure'ları açıklayacağız. 2 - Sonra, execute eden bir programın bu data structure'ları kullanarak, virtual fonksiyonları nasıl çalıştırdıklarını ve polymorphism ile ilişkili dynamic binding'i nasıl başardığını göreceğiz. ) Our discussion explains one possible implementation;this is not a language requirement.when C++ compiles a class that has one or more virtual functions, it builds a virtual function table (vtable) for that class. An executing program uses the vtable to select the proper function implementation each time a virtual function of that class is called. The leftmost column of Fig illustrates the vtables for the classes Employee, SalariedEmployee, CommissionEmployee and BasePlusCommissionEmployee. ( Anlatacağımız şey, muhtemel bir implementation'dır, bir language requirement falan değildir. C++, bir veya daha fazla virtual fonksiyona sahip bir class'ı compile edince, bu class için bir virtual function table (vtable) build(inşaa) eder. Bu class'ın bir virtual fonksiyonu çağırıldığında, Executing(çalışmakta olan) program uygun function implementation'ı seçmek için vtable'ı kullanır. Figure 13.18'in en soldaki sütunu 4 farklı class için olan vtable'ları gösterir. ) Employee Class vtable In the vtable for class Employee, the first function pointer is set to 0 (i.e., the null pointer).this is done because function earnings is a pure virtual function and therefore lacks an implementation. The second function pointer points to function print, which displays the employee s full name and social security number. [Note: We ve abbreviated the output of each print function in this figure to conserve space.] ( Employee class'ı için olan vtable'da, birinci function pointer sıfır(0)!a set edilmiştir. Yani bu bir null pointer'dır; çünkü earnings, bir pure virtual fonksiyondur, dolayısıyla implementation'a sahip değildir. İkinci function pointer, print fonksiyonuna point eder. ) Any class that has one or more null pointers in its vtable is an abstract class. Classes without any null vtable pointers (such as SalariedEmployee, CommissionEmployee and BasePlusCommissionEmployee) are concrete classes. ( Vtable'ında en az bir tane null pointer olan bir class, abstract class'dır. Hiç null pointer'ı olmayan class'lar ise concrete class'lardır, örneğin SalariedEmployee, CommissionEmployee and BasePlusCommissionEmployee class'larının vtable'larında hiç null pointer yoktur, çünkü bunlar concrete class'dırlar. ) SalariedEmployee Class vtable Class SalariedEmployee overrides function earnings to return the employee s weekly salary, so the function pointer points to the earnings function of class SalariedEmployee. SalariedEmployee also overrides print, so the corresponding function pointer points to the SalariedEmployee member function that prints "salaried employee: " followed by
43 the employee s name, social security number and weekly salary. ( SalariedEmployee class'ı, Employee class'ının earnings fonksiyonunu override eder, dolayısıyla function pointer SalariedEmployee class'ının earnings fonksiyonuna point eder. Ayrıca bu class, print fonksiyonunu da override eder, dolayısıyla function pointer bu class'ın print member function'ına point eder. )
44 CommissionEmployee Class vtable The earnings function pointer in the vtable for class CommissionEmployee points to CommissionEmployee s earnings function that returns the employee s gross sales multiplied by the commission rate. The print function pointer points to the CommissionEmployee version of the function. As in class HourlyEmployee, both functions override the functions in class Employee. ( CommissionEmployee class'ının vtable'ındaki earnings function pointer'ı, CommissionEmployee class'ının earnings fonksiyonuna point eder. Ayrıca bu class'ın vtable'ındaki print function pointer'ı, bu class'ının kendisinin print fonksiyonuna point eder. HourlyEmployee class'ındaki gibi, her iki fonksiyon da Employee class'ının fonksiyonlarını override ederler. ) BasePlusCommissionEmployee Class vtable The earnings function pointer in the vtable for class BasePlusCommissionEmployee points to the BasePlusCommissionEmployee s earnings function. The print function pointer points to the BasePlusCommissionEmployee version of the function. Both functions override the functions in class CommissionEmployee. ( BasePlusCommissionEmployee class'ının vtabe'ındaki earnings function pointer, class'ın kendisinin earnings fonksiyonuna point eder. Print function pointer ise, gene aynı class'ın print fonksiyonuna return eder. eder. ) Her iki fonksiyon da CommissionEmployee base class'ının fonksiyonları override Inheriting Concrete virtual Functions In our Employee case study, each concrete class provides its own implementation for virtual functions earnings and print. You ve learned that each class which inherits directly from abstract base class Employee must implement earnings in order to be a concrete class, because earnings is a pure virtual function. These classes do not need to implement function print, however, to be considered concrete print is not a pure virtual function and derived classes can inherit class Employee s implementation of print. ( Bizim Employee class hiyerarşimizdeki herbir concrete class, earnings ve print virtual fonksiyonları için kendi implementation'larını sağlarlar. Abstract base classemployee'den doğrudan türeyen bir class, concrete class olabilmesi için, earnings fonksiyonunu implement etmek zorundadır.ancak print fonksiyonunu implement etmese de olur, çünkü bu fonksiyon pure virtual değildir, virtual'dır; derived class'lar Employee class'ının print implementation'ının miras alabilir. ) Furthermore, class BasePlusCommissionEmployee does not have to implement either function print or earnings - both function implementations can be inherited from class CommissionEmployee.
45 ( Ayrıca, BasePlusCommissionEmployee class'ı, print ve earnings fonksiyonlarını implement etmek zorunda değildir, her iki fonksiyonun implementation'ları da bir üst base class olan CommissionEmployee'den miras yoluyla alınabilir. ) If a class in our hierarchy were to inherit function implementations in this manner, the vtable pointers for these functions would simply point to the function implementation that was being inherited. For example, if BasePlusCommissionEmployee did not override earnings, the earnings function pointer in the vtable for class BasePlusCommissionEmployee would point to the same earnings function as the vtable for class CommissionEmployee points to. ( Hiyerarşimizdeki bir class bu şekilde function implementation'larını miras alırsa, bu fonksiyonlar için olan vtable pointer'ları, miras alınan function implementation'a point eder. Örneğin, BasePlusCommissionEmployee class'ı, earnings fonksiyonunu override etmemiştir, dolayısıyla bu class'ın vtable'ındaki earnings function pointer'ı, CommissionEmployee(direct base class) class'ının vtable'ındaki earnings fonksiyonunun point ettiği aynı yere point eder. ) Three Levels of Pointers to Implement Polymorphism Polymorphism is accomplished through an elegant data structure involving three levels of pointers. We ve discussed one level the function pointers in the vtable. These point to the actual functions that execute when a virtual function is invoked. ( Polymorphism nasıl başarılır? 3 seviyeli pointer içeren bir data structure kullanılarak. BU seviyelerden bir tanesini, vtable'da function pointer'lar konusunu konuşurken anlattık. Bir virtual fonksiyon invoke edildiğinde, execute edilecek asıl fonksiyona point eder bu function pointer. ) Now we consider the second level of pointers. Whenever an object of a class with one or more virtual functions is instantiated, the compiler attaches to the object a pointer to the vtable for that class. This pointer is normally at the front of the object, but it isn t required to be implemented that way. In Fig , these pointers are associated with the objects created in Fig (one object for each of the types SalariedEmployee, CommissionEmployee and BasePlusCommissionEmployee). The diagram displays each of the object s data member values. For example, the salariedemployee object contains a pointer to the SalariedEmployee vtable; the object also contains the values John Smith, and $ (Şimdi ise pointer'ların second level'ini(2.seviyesini) anlatacağız.bir veya daha fazla virtual fonksiyona sahip bir class'dan object instantiate edince, compiler bu object'e şöyle bir pointer attach eder : bu class'ın vtable'ına pointer Bu pointer genellikle object'in karşısında olur, ancak bu şekilde implement etme zorunluluğu yoktur. Figure 13.18'da bu pointer'lar Figure 13.17'de create edilen object'ler ile ilişkilendirilmiştir. ( SalariedEmployee, CommissionEmployee and BasePlusCommissionEmployee class'larından create edilen herbir object için bu böyledir). Bu diagram, herbir object'in data member değerlerini göstereir. Örneğin, salariedemployee object'leri, salariedemployee vtable'ına pointer içerir, bu object ayrıca şub değerleri de içerir : John Smith, and $ )
46 The third level of pointers simply contains the handles to the objects that receive the virtual function calls. The handles in this level may also be references. Fig depicts the vector employees that contains Employee pointers. ( pointer ların third level i(3. seviyesi) handle ları içerir. Ne handle ı : virtual function call ları receive eden object lere handle lar. Bu level deki handle lar reference lar da olabilir. Figure 13.18, Employee pointer larını içeren employees isimli vektörü gösterir. ) Now let s see how a typical virtual function call executes. Consider the call baseclassptr->print() in function virtualviapointer (line 69 of Fig ). Assume that baseclassptr contains employees[ 1 ] (i.e., the address of object commissionemployee in employees). When the compiler compiles this statement, it determines that the call is indeed being made via a base-class pointer and that print is a virtual function. ( Bir virtual fonksiyon nasıl execute edilir(çalıştırılır), inceleyelim. Figure deki virtualviapointer fonksiyonunda, baseclassptr->print() satırı execute edildiğini düşünelim. baseclassptr nin employees[1] i içerdiğini(yani employees vektöründeki commissionemployee object inin adresini içerdiğini) assume edelim. Compiler bu statement ı compile edince, bu function ın aslında base-class pointer aracılığıyla çağırıldığını, ve print in virtual fonksiyon olduğunu saptar, belirler. ) The compiler determines that print is the second entry in each of the vtables. To locate this entry, the compiler notes that it will need to skip the first entry. Thus, the compiler compiles an offset or displacement into the table of machine-language object-code pointers to find the code that will execute the virtual function call. The size in bytes of the offset depends on the number of bytes used to represent a pointer on an individual platform. For example, on a 32-bit platform, a pointer is typically stored in 4 bytes, whereas on a 64-bit platform, a pointer could be stored in 8 bytes. ( Compiler, print in herbir vtable daki 2. Entry olduğunu saptar. Bu entry yi locate etmek için, compiler 1.entry yi skip etmesi gerektiğini bir kenara not eder. Dolayısıyla compiler, virtual fonksiyon kodunu execute edecek kodu bulmak için, machine language object-code pointer ın table ına offset,displacement compile eder. ) The compiler generates code that performs the following operations [Note: The numbers in the list correspond to the circled numbers in Fig ] ( Compiler, aşağıdaki anlattığımız adımlardaki işleri yapacak kodu generate eder.(şunu da not etmekte fayda var. Figure deki yuvarlak içine aldığımız numaralar, burada anlattığımız adım numaralarına karşılık gelir.) : 1. Select the ith entry of employees (in this case, the address of object commissionemployee), and pass it as an argument to function virtualviapointer. This sets parameter baseclassptr to point to commissionemployee.
47 ( employee isimli vektörün i. elemanı seçilir. Bizim case imizde, commissionemployee object inin address idir bu seçilen. Bu adres virtualviapointer fonksiyonuna argument olarak pass edilir. Bu da baseclassptr yi set eder. baseclassptr, commissionemployee object e point eder. ) 2. Dereference that pointer to get to the commissionemployee object which, as you recall, begins with a pointer to the CommissionEmployee vtable. ( Bu pointer dereference edilerek, commissionemployee object e ulaşılır. Bu object, CommissionEmployee vtable ına pointer ile başlar. ) 3. Dereference commissionemployee s vtable pointer to get to the CommissionEmployee vtable. ( commissionemployee object inin vtable pointer ı dereference edilerek, CommissionEmployee class ının vtable ına ulaşılır. ) 4. Skip the offset of four bytes to select the print function pointer. ( 4 byte lık offset i skip et, böylece print function pointer ına ulaş. ) 5. Dereference the print function pointer to execute the appropriate print function. ( print function pointer ı dereference edilerek, uygun print fonksiyonu execute edilir. ) Fig s data structures may appear to be complex, but this complexity is managed by the compiler and hidden from you, making polymorphic programming straightforward. The pointer dereferencing operations and memory accesses that occur on every virtual function call require some additional execution time. The vtables and the vtable pointers added to the objects require some additional memory. You now have enough information to determine whether virtual functions are appropriate for your programs. (Figure deki data structure complex gözükebilir ama bu karışıklık compiler tarafından yönetilir,compiler ın kontrolü altındadır, ve sizden gizlenir. Bu da polymorphic programlama yı basitleştirir. Herbir virtual function çağırılırken, gerçekleşen dereferencing operation ları ve memory erişimleri, ekstra execution time gerektirir. Object lere eklenen vtable lar ve vtable pointer ları ekstra memory gerektirir. Artık programınız için virtual fonksiyonların uygun mu değil mi olduğuna karar verebilecek kadar yeterli bilgiye sahipsiniz.) Performance Tip 13.1 Polymorphism, as typically implemented with virtual functions and dynamic binding in C++, is efficient. You can use these capabilities with nominal impact on performance. ( C++ da genellikle virtual fonksiyonlar ve dynamic binding ile implement edilen polymorphism efficient dır. ) Performance Tip 13.2 Virtual functions and dynamic binding enable polymorphic programming as an alternative to switch logic programming. Optimizing compilers normally generate polymorphic code that runs as efficiently as hand-coded switch-based logic. Polymorphism s overhead is acceptable for most applications. But in some situations such as real-time applications with stringent performance requirements polymorphism s overhead may be too high.
48 13.8 Case Study: Payroll System Using Polymorphism and Runtime Type Information with Downcasting, dynamic_cast, typeid and type_info Recall from the problem statement at the beginning of Section 13.6 that, for the current pay period, our fictitious company has decided to reward BasePlusCommissionEmployees by adding 10 percent to their base salaries. ( Section 13.6 nın başındaki problem statement ı hatırlayalım: şirketimiz BasePlusCommissionEmployees çalışanlarının sabit maaş kısımlarına yüzde 10 zam vermek istiyordu. ) Now, however, to adjust the base salaries of BasePlusCommissionEmployees, we have to determine the specific type of each Employee object at execution time, then act appropriately. ( BasePlusCommissionEmployees in sabit maaş kısmını ayarlamak için, herbir Employee object inin specific type ını execution time da saptamamız lazım. ) This section demonstrates the powerful capabilities of runtime type information (RTTI) and dynamic casting, which enable a program to determine the type of an object at execution time and act on that object accordingly. [Note: Some compilers require that RTTI be enabled before it can be used in a program. In Visual C , this option is enabled by default.] ( Bu section, RTTI nın ve dynamic casting in güçlü kabiliyetlerini gösterir. Bu sayede, programımız bir object in type ını execution-time da saptayacak. Bazı compiler lar, RTTI ın bir programda kullanılmadan önce enable edilmesini gerektirir. ) Figure uses the Employee hierarchy developed in Section 13.6 and increases by 10 percent the base salary of each BasePlusCommissionEmployee. ( Figure daki program, Section 13.6 da anlattığımız aynı Employee class hiyerarşisini kullanır, herbir BasePlusCommissionEmployee nin base maaşını yüzde 10 arttırır. ) Line 21 declares three element vector employees that stores pointers to Employee objects. Lines populate the vector with the addresses of dynamically allocated objects of classes SalariedEmployee (Figs ), CommissionEmployee (Figs ) and BasePlusCommissionEmployee (Figs ). ( 21.satırda, 3 elemanlı bir vektör declare edilir, bu vektörün elemanları Employee ye pointer dır Satırlar arasında, vektör, 3 class ın dynamically allocate edilen object lerinin adresleri ile doldurulur. )
49
50 The for statement in lines iterates through the employees vector and displays each Employee s information by invoking member function print (line 34). Recall that because print is declared virtual in base class Employee, the system invokes the appropriate derived-class object s print function. (32-54.satırlar arasında, employees isimli vektör traverse edilir, herbir Employee nin print member fonksiyonu çağırılır. Print fonksiyonu, base class Employee de virtual olarak declare edildiği için, program uygun derived-class ın print fonksiyonunu invoke eder(çağırır). ) In this example, as we encounter BasePlusCommissionEmployee objects, we wish to increase their base salary by 10 percent. Since we process the employees generically (i.e., polymorphically), we cannot (with the techniques we ve learned) be certain as to which type of Employee is being manipulated at any given time. ( Bu örnekte, BasePlusCommissionEmployee object ine rastladığımızda, base salary yi yüzde 10 arttırmak istiyoruz. employees vektörü üzerinde gezerken, herhangi bir zamanda Employee nin hangi type ı manipulate ettiğimizi bilemeyiz şimdiye kadar öğrendiğimiz şeylerle. ) This creates a problem, because BasePlusCommissionEmployee employees must be identified when we encounter them so they can receive the 10 percent salary increase. To accomplish this, we use operator dynamic_cast (line 39) to determine whether the type of each object is BasePlusCommissionEmployee. This is the downcast operation we referred to in Section
51 ( Bu bir sorundur, çünkü bizim BasePlusCommissionEmployee type ındaki çalışanları tespit etmek zorundayız. Bunu başarabilmek için, dynamic_cast operator ünü kullanırız. Bu operator ı kullanarak, herbir object in type ının BasePlusCommissionEmployee olup olmadığını belirleriz. Section de refer ettiğimiz,bahsettiğimiz downcast operation işte budur. ) Lines dynamically downcast employees[i] from type Employee * to type BasePlusCommissionEmployee *. If the vector element points to an object that is a BasePlusCommissionEmployee object, then that object s address is assigned to commissionptr; otherwise, 0 is assigned to derived-class pointer derivedptr. ( Satırlar arasında, employees[i], Employee * type ından BasePlusCommissionEmployee * type ına downcast edilir. Eğer vector ün elemanı BasePlusCommissionEmployee object e point ediyorsa, bu object in adresi commissionptr ye assign edilir, otherwise(yani bu vektörün elemanı BasePlusCommissionEmployee ye point etmiyorsa) derived-class pointer olan derivedptr ye 0 assign edilir. ) If the value returned by the dynamic_cast operator in lines is not 0, the object is the correct type, and the if statement (lines 44 51) performs the special processing required for the BasePlusCommissionEmployee object. ( Satırlar arasında, dynamic_cast operator ının return ettiği değer 0 değilse, object doğru type dır, ve Satırlar arasındaki if statement body execute edilir. ) Line 53 invokes member function earnings on the object to which employees[i] points. Recall that earnings is declared virtual in the base class, so the program invokes the derivedclass object s earnings function another example of dynamic binding. (53. satırda, employees[i] nin point ettiği object deki earnings member function invoke edilir. Bu fonksiyon base class da virtual olarak declare edildiği için, program derivedclass object in earnings fonksiyonunu invoke eder. Bu da dynamic binding in başka bir örneğidir. ) Lines display each employee s object type and uses the delete operator to deallocate the dynamic memory to which each vector element points. Operator typeid (line 61) returns a reference to an object of class type_info that contains the information about the type of its operand, including the name of that type. ( Satırlarda, herbir employee nin object type ı display edilir(gösterilir); ve delete operator kullanılarak, herbir vektör elemanının point ettiği dynamic memory deallocate edilir. 61. satırda, typeid operator ı ne return eder? type_info class ının bir object ine reference return eder. Peki bu object ne içerir? Operand ının type ı hakkında bilgiler içerir, bu type ın ismini içerir. )
52 When invoked, type_info member function name (line 51) returns a pointer-based string that contains the type name (e.g., "class BasePlusCommissionEmployee") of the argument passed to typeid. ( Invoke edildiğinde, type_info class ının member function ı olan name şunu return eder: typeid operator ına pass edilen(verilen) argument in type ismini(örneğin, class BasePlusCommissionEmployee) içeren string return eder. ) To use typeid, the program must include header <typeinfo> (line 8). ( typeid operator ını kullanabilmek için <typeinfo> header ı, programa include edilmelidir.) Portability Tip 13.1 The string returned by type_info member function name may vary by compiler. ( Type_info operator ının return ettiği string compiler lara göre değişiklik gösterebilir. ) We avoid several compilation errors in this example by downcasting an Employee pointer to a BasePlusCommissionEmployee pointer (lines 38 40). If we remove the dynamic_cast from line 39 and attempt to assign the current Employee pointer directly to BasePlusCommissionEmployee pointer derivedptr, we ll receive a compilation error. C++ does not allow a program to assign a base-class pointer to a derived-class pointer because the is-a relationship does not apply a CommissionEmployee is not a BasePlusCommissionEmployee. The is-a relationship applies only between the derived class and its base classes, not vice versa. ( Bu örnekte satırlarda, Employee pointer ı, BasePlusCommissionEmployee pointer a downcast ederek muhtemel compilation error ları önledik. Eğer 39. Satırdaki dynamic_cast i silersek, BasePlusCommissionEmployee * = Employee * assignment ını yapmaya kalkışırsak, compilation error alırız. C++ şu assignment a izin vermez yani: derivedclass pointer = base-class pointer, çünkü is-a relationship i yoktur. Is-a relationship, sadece derived-class lar ve base class lar arasında vardır(derived-class is-a base-class) ama tersi doğru değildir. ) Similarly, if lines 46, 48 and 50 used the current base-class pointer from employees, rather than derived-class pointer derivedptr, to invoke derived-class-only functions get- BaseSalary and setbasesalary, we would receive a compilation error at each of these lines. As you learned in Section , attempting to invoke derived-class-only functions through a base-class pointer is not allowed. Although lines 46, 48 and 50 execute only if commissionptr is not 0 (i.e., if the cast can be performed), we cannot attempt to invoke derived-class BasePlusCommissionEmployee functions getbasesalary and setbasesalary on the base-class Employee pointer. Recall that, using a base class Employee pointer, we can invoke only functions found in base class Employee earnings, print and Employee s get and set functions.
53 ( Benzer şekilde, 46,48 ve 50. Satırlarda, derived-class pointer olan derivedptr değil de, base-class pointer kullanılsaydı, bu pointer aracılığıyla derived-class-only function lar çağırılsaydı ne olurdu? 3 satırın herbirinde de compilation error olurdu. Hatırlayalım, Section de de öğrenmiştik, base-class pointer aracılığıyla derived-class-only fonksiyonları invoke etmeye izin vermez compiler. 46,48 ve 50. Satırlar, commissionptr 0 değilse execute edilir,yani cast gerçekleştirilebilirse. Buna rağmen, base-class Employee pointer aracılığıyla, derived-class BasePlusCommissionEmployee nin fonksiyonları olan getbasesalary ve setbasesalary yi invoke edemeyiz. Hatırlayalım, base class olan Employee pointer kullanılarak, sadece baseclass Employee de varolan fonksiyonları invoke edebiliriz, nedir o fonksiyonlar : earnings, print and Employee s get and set functions. ) 13.9 Virtual Destructors *Here* A problem can occur when using polymorphism to process dynamically allocated objects of a class hierarchy. So far you ve seen nonvirtual destructors destructors that are not declared with keyword virtual. If a derived-class object with a nonvirtual destructor is destroyed explicitly by applying the delete operator to a base-class pointer to the object, the C++ standard specifies that the behavior is undefined. ( Bir class ın dynamically allocated object lerini process etmek için polymorphism i kullanırken,sroun çıkabilir. Şimdiye kadar nonvirtual destructor ları gördük. Nedir nonvirtual destructor? virtual keyword ile declare edilmemiş destructor lardır. Eğer nonvirtual destructor a sahip bir derived-class object, object e point eden baseclass pointer a delete operator uygulanarak explicitly destroy edilirse, C++ da bu davranış undefined dır(tanımsızdır). ) The simple solution to this problem is to create a virtual destructor (i.e., a destructor that is declared with keyword virtual) in the base class. This makes all derived class destructors virtual even though they do not have the same name as the baseclass destructor. ( Bu sorunu çözmek için, base class da virtual destructor create etmek gerekir. Bu, tüm derived class ların destructor larını virtual yapar, derived class ların destructor larının isimleri ve base-class destructor larının isimleri aynı olmasa bile. Destructor isimleri neden farklı olsun ki ya burada ne demek istemiş? ) Now, if an object in the hierarchy is destroyed explicitly by applying the delete operator to a base-class pointer, the destructor for the appropriate class is called based on the object to which the base-class pointer points. ( Base-class pointer a delete operator uygulanarak, bir object explicitly destroy edilmeye çalışılırsa, base-class pointer ın point ettiği object in destructor ı çağırılır. )
54 Remember, when a derived-class object is destroyed, the base-class part of the derived-class object is also destroyed, so it s important for the destructors of both the derived class and base class to execute. The base-class destructor automatically executes after the derived-class destructor. ( derived-class ın bir object i destroy edilirse, derived-class object in base-class kısmı da destroy edilir, dolayısıyla hem base-class ın hem de derived-class ın destructor larını execute etmek önemlidir. Base-class destructor, derived-class destructor lardan sonra otomatik olarak execute edilir. ) Error-Prevention Tip 13.2 If a class has virtual functions, provide a virtual destructor, even if one is not required for the class. This ensures that a custom derived-class destructor (if there is one) will be invoked when a derived-class object is deleted via a base class pointer. ( Eğer bir class virtual fonksiyonlara sahipse, class ın için virtual destructor provide et. Bu, class içn gerekli olmasa bile. Böylece şundan emin oluruz: base-class pointer aracılığıyla derived-class bir object delete edilirse(silinirse), custom derived-class ın destructor ı(tabi varsa böyle bir destructor) invoke edilir(çağırılır). ) Common Programming Error 13.2 Constructors cannot be virtual. Declaring a constructor virtual is a compilation error. (Constructor lar virtual olamaz. Bbir constructor ı virtual olarak declare etmek, compilation error dır.) Wrap-Up In this chapter we discussed polymorphism, which enables us to program in the general rather than program in the specific, and we showed how this makes programs more extensible. We began with an example of how polymorphism would allow a screen manager to display several space objects. We then demonstrated how base-class and derived-class pointers can be aimed at base-class and derived-class objects. We said that aiming base-class pointers at base-class objects is natural, as is aiming derived-class pointers at derived class objects. Aiming base-class pointers at derived-class objects is also natural because a derived-class object is an object of its base class. ( base-class ve derived-class pointer ları nın, base-class ve derived-class object lere point ettiği durumları inceledik. Base-class pointer ın derived-class object e point etmesi doğaldır çünkü derived-class object is-a base-class object dir. ) You learned why aiming derived-class pointers at base-class objects is dangerous and why the compiler disallows such assignments.
55 ( derived-class pointer ın, base-class object e point etmesi, tehlikelidir, bunun neden tehlikeli olduğunu açıkladık, compiler ın bu assignment a neden izin vermediğini açıkladık. ) We introduced virtual functions, which enable the proper functions to be called when objects at various levels of an inheritance hierarchy are referenced (at execution time) via base-class pointers or references. This is known as dynamic or late binding. ( virtual fonksiyon ları öğrendik, bu fonksiyonlar bize şunu sağlıyordu: base-class pointer veya reference aracılığıyla, inheritance hiyerarşisindeki class ların object lerinden biri çağırıldığında, uygun,doğru fonksiyon çağırılır virtual fonksiyonlar sayesinde. Buna dynamic binding veya late binding denir. ) We then discussed pure virtual functions and abstract classes (classes with one or more pure virtual functions). You learned that abstract classes cannot be used to instantiate objects, while concrete classes can. We then demonstrated using abstract classes in an inheritance hierarchy. You learned how polymorphism works under the hood with vtables that are created by the compiler. We used runtime type information (RTTI) and dynamic casting to determine the type of an object at execution time and act on that object accordingly. ( Pure virtual fonksiyonları ve abstract class ları(en az bir tane virtual fonksiyon içeren class lar) öğrendik. Inheritance hiyerarşisinde abstract class ları kullanmayı öğrendik. Compiler tarafından create edilen vtable lar kullanılarak, polymorphism in nasıl çalıştığını öğrendik. RTTI ve dynamic binding kullanarak execution time da bir object in type ını bulmayı öğrendik. ) The chapter concluded with a discussion of virtual destructors, and how they ensure that all appropriate destructors in an inheritance hierarchy run on a derived-class object when that object is deleted via a base-class pointer or reference. ( base-class pointer veya reference aracılığıyla, bir object delete edildiğinde, inheritance hiyerarşisindeki uygun destructor lar, derived-class object de çalışır. ) (Bir sonraki chapter da, template leri öğreneceğiz) Summary Section 13.1 Introduction Polymorphism (p. 535) enables us to program in the general rather than program in the specific. Polymorphism enables us to write programs that process objects of classes that are part of the same class hierarchy as if they were all objects of the hierarchy s base class. ( Bir class hiyerarşisindeki class ların object lerini(sanki tüm object ler hiyerarşideki base-class ın object leri gibi düşünülerek) process edebilmemizi sağlar polymorphism. ) With polymorphism, we can design and implement systems that are easily extensible new classes can be added with little or no modification to the general portions of
56 the program. The only parts of a program that must be altered to accommodate new classes are those that require direct knowledge of the new classes that you add to the hierarchy. Section 13.2 Introduction to Polymorphism: Polymorphic Video Game With polymorphism, one function can cause different actions to occur, depending on the type of the object on which the function is invoked. ( Polymorphism sayesinde, bir fonksiyon çağırıldığı object in type ına göre farklı action lar gerçekleştirebilebilir. ) This makes it possible to design and implement more extensible systems. Programs can be written to process objects of types that may not exist when the program is under development. Section 13.3 Relationships Among Objects in an Inheritance Hierarchy C++ enables polymorphism the ability for objects of different classes related by inheritance to respond differently to the same member-function call. (Aynı member function ları çağırınca, inheritance ilişkisi olan farklı class lar farklı şekilde tepki verir. ) Polymorphism is implemented via virtual functions (p. 543) and dynamic binding (p. 544). ( Polymorphism, virtual fonksiyonlar ve dynamic binding aracılığıyla implement edilir. ) When a base-class pointer or reference is used to call a virtual function, C++ chooses the correct overridden function in the appropriate derived class associated with the object. ( Bir virtual fonksiyonu çağırmak için, base-class pointer veya reference kullanılırsa, uygun derived-class ın doğru overridden fonksiyonunu invoke eder C++. ) If a virtual function is called by referencing a specific object by name and using the dot member selection operator, the reference is resolved at compile time (this is called static binding; p. 544); the virtual function that is called is the one defined for the class of that particular object. ( myobject.virtualfunction() : reference compile-time da resolve edilir(çözülür). Buna static binding denir. Particular object in virtual fonksiyonu çağırılır. ) Derived classes can provide their own implementations of a base-class virtual function if necessary, but if they do not, the base class s implementation is used. ( Derived-class lar, base-class virtual fonksiyonları override edebilirler isterlerse, override etmezlerse base class ın function implementation ı kullanılır. ) Section 13.4 Type Fields and switch Statements Polymorphic programming with virtual functions can eliminate the need for switch logic. You can use the virtual function mechanism to perform the equivalent logic automatically, thus avoiding the kinds of errors typically associated with switch logic. ( Virtual fonksiyonları kullanarak polymorphic programlama yapmak, switch logic e olan ihtiyacı ortadan kaldırır. Virtual fonksiyon mekanizmasını kullanarak aynı switch logic mantığını elde edebiliriz, böylece switch logic in error ları ile de uğraşmamış oluruz. )
57 Section 13.5 Abstract Classes and Pure virtual Functions Abstract classes (p. 550) are typically used as base classes, so we refer to them as abstract base classes (p. 550). No objects of an abstract class may be instantiated. (Abstract class lar genellikle base class lardır, dolayısıyla bunlara abstract base class deriz. Abstract class dan object instantiate(create) edilemez.) Classes from which objects can be instantiated are concrete classes (p. 550). ( Sadece concrete class lardan object instantiate edilebilir. ) You create an abstract class by declaring one or more pure virtual functions (p. 551) with pure specifiers (= 0) in their declarations. ( Abstract base class nasıl declare edilir? En az bir tane pure virtual function declare ederek,peki nasıl? Pure specifier (=0) kullanarak. ) If a class is derived from a class with a pure virtual function and that derived class does not supply a definition for that pure virtual function, then that virtual function remains pure in the derived class. Consequently, the derived class is also an abstract class. ( Abstract base class dan derive eden bir class da pure virtual fonksiyon implement edilmezse, bu derived class da abstract class olarak kalır. ) Although we cannot instantiate objects of abstract base classes, we can declare pointers and references to objects of abstract base classes. Such pointers and references can be used to enable polymorphic manipulations of derived-class objects instantiated from concrete derived classes. ( Abstract base class ların object lerine pointer veya reference declare edilebilir: AbstractBaseClass * is allowed. Bu gibi pointer lar ve reference lar, concrete derived class lardan instantiate edilen object lerin polymorphic manipulasyonunda kullanılabilir. ) Section 13.7 (Optional) Polymorphism, Virtual Functions and Dynamic Binding Under the Hood Dynamic binding requires that at runtime, the call to a virtual member function be routed to the virtual function version appropriate for the class. A virtual function table called the vtable (p. 567) is implemented as an array containing function pointers. Each class with virtual functions has a vtable. For each virtual function in the class, the vtable has an entry containing a function pointer to the version of the virtual function to use for an object of that class. The virtual function to use for a particular class could be the function defined in that class, or it could be a function inherited either directly or indirectly from a base class higher in the hierarchy. ( Dynamic binding şunu gerektirir: Bir virtual function çağırılınca, uygun class ın virtual function versiyonuna yönlendirilir. Virtual function table(vtable), function pointer ları içeren bir array dir. Virtual bir fonksiyona sahip olan herbir class, vtable a da sahiptir. Class daki herbir virtual fonksiyon için, vtable bir entry(eleman) ye sahiptir, bu entry bir function pointer içerir,bu function pointer, bu object in virtual fonksiyon versiyonuna point eder. Particular bir class için kullanılacak olan virtual fonksiyon, bu class da define edilmiş bir fonksiyon da olabilir, hiyararşideki bir base class dan directly veya indirectly miras alınmış bir fonksiyon da olabilir. ) When a base class provides a virtual member function, derived classes can override the virtual function, but they do not have to override it.
58 ( Base function da virtual member function var diyelim, derived class lar bu function ı override edebilir, ancak etmek zorunda değildirler, concrete class olabilmek için. ) Each object of a class with virtual functions contains a pointer to the vtable for that class. When a function call is made from a base-class pointer to a derived-class object, the appropriate function pointer in the vtable is obtained and dereferenced to complete the call at execution time. ( Virtual fonksiyona sahip bir class dan instantiate edilmiş bir object ne içerir? Bu class ın vtable ına pointer. derived-class object e point eden bir base-class pointer aracılığıyla bir fonksiyon çağırılırsa, vtable daki uygun fonksiyon obtain edilir(elde edilir), ve executiontime daki call ı tamamlamak için dereference edilir. ) Any class that has one or more 0 pointers in its vtable is an abstract class. Classes without any 0 vtable pointers are concrete classes. ( Bir class ın vtable ında en az bir tane null pointer varsa, bu class abstract dır. ) New kinds of classes are regularly added to systems and accommodated by dynamic binding. (Yeni class lar eklenir sisteme düzenli olarak ve bu dynamic binding tarafından düzenlenir. ) Section 13.8 Case Study: Payroll System Using Polymorphism and Runtime Type Information with Downcasting, dynamic_cast, typeid and type_info Operator dynamic_cast (p. 571) checks the type of the object to which a pointer points, then determines whether the type has an is-a relationship with the type to which the pointer is being converted. If so, dynamic_cast returns the object s address. If not, dynamic_cast returns 0. ( dynamic_cast ne yapar? Bir pointer ın point ettiği objenin type ını check eder. sonra pointer convert edilmeye çalışıldığı type ile is-a relationship var mı bunu belirler. Varsa, dynamic_cast object in adresini return eder, yoksa 0 return eder. ) Operator typeid (p. 573) returns a reference to a type_info object (p. 573) that contains information about the operand s type, including the type name. To use typeid, the program must include header <typeinfo> (p. 573). ( typeid ne yapar? Type_info object ine reference return eder. Type_info object ne içerir? Operand ın type ını, type ın ismini içerir. Typeid yi kullanabilmek için, <typeinfo> header ı include edilmelidir. ) When invoked, type_info member function name (p. 573) returns a pointer-based string that contains the name of the type that the type_info object represents. *Here* Operators dynamic_cast and typeid are part of C++ s runtime type information (RTTI; p. 571) feature, which allows a program to determine an object s type at runtime. Section 13.9 Virtual Destructors
59 Declare the base-class destructor virtual (p. 574) if the class contains virtual functions. This makes all derived-class destructors virtual, even though they do not have the same name as the base-class destructor. If an object in the hierarchy is destroyed explicitly by applying the delete operator to a base-class pointer to a derived-class object, the destructor for the appropriate class is called. After a derived-class destructor runs, the destructors for all of that class s base classes run all the way up the hierarchy.
Object-Oriented Programming Laboratuvar 11
Object-Oriented Programming Laboratuvar 11 19.12.2017 We use abstract class Employee to represent the general concept of an employee. The classes that derive directly from Employee are SalariedEmployee
Maltepe Üniversitesi Bilgisayar Mühendisliği Bölümü BİL 203 Veri Yapıları ve Algoritmalar I
Maltepe Üniversitesi Bilgisayar Mühendisliği Bölümü BİL 203 Veri Yapıları ve Algoritmalar I GENEL DERS BİLGİLERİ Öğretim Elemanı : İzzet TAMER Ofis : MUH 311 Ofis Saatleri : Pazartesi: 14:10 15:00, Salı:
Virtualmin'e Yeni Web Sitesi Host Etmek - Domain Eklemek
Yeni bir web sitesi tanımlamak, FTP ve Email ayarlarını ayarlamak için yapılması gerekenler Öncelikle Sol Menüden Create Virtual Server(Burdaki Virtual server ifadesi sizi yanıltmasın Reseller gibi düşünün
Unlike analytical solutions, numerical methods have an error range. In addition to this
ERROR Unlike analytical solutions, numerical methods have an error range. In addition to this input data may have errors. There are 5 basis source of error: The Source of Error 1. Measuring Errors Data
WEEK 11 CME323 NUMERIC ANALYSIS. Lect. Yasin ORTAKCI.
WEEK 11 CME323 NUMERIC ANALYSIS Lect. Yasin ORTAKCI [email protected] 2 INTERPOLATION Introduction A census of the population of the United States is taken every 10 years. The following table
CmpE 320 Spring 2008 Project #2 Evaluation Criteria
CmpE 320 Spring 2008 Project #2 Evaluation Criteria General The project was evaluated in terms of the following criteria: Correctness (55 points) See Correctness Evaluation below. Document (15 points)
Inheritance. Inheritance (turetim)
Inheritance (turetim) Bir cok problemin cozumu icin belirlenen class lar hierarsik bir yapi seklinde organize edilebilir C++ gibi bir cok Object-oriented diller class benzerliklerinin etkin bir sekilde
Bağlaç 88 adet P. Phrase 6 adet Toplam 94 adet
ÖNEMLİ BAĞLAÇLAR Bu liste YDS için Önemli özellikle seçilmiş bağlaçları içerir. 88 adet P. Phrase 6 adet Toplam 94 adet Bu doküman, YDS ye hazırlananlar için dinamik olarak oluşturulmuştur. 1. although
Argumentative Essay Nasıl Yazılır?
Argumentative Essay Nasıl Yazılır? Hüseyin Demirtaş Dersimiz: o Argumentative Essay o Format o Thesis o Örnek yazı Military service Outline Many countries have a professional army yet there is compulsory
First Stage of an Automated Content-Based Citation Analysis Study: Detection of Citation Sentences
First Stage of an Automated Content-Based Citation Analysis Study: Detection of Citation Sentences Zehra Taşkın, Umut Al & Umut Sezen {ztaskin, umutal, u.sezen}@hacettepe.edu.tr - 1 Plan Need for content-based
IDENTITY MANAGEMENT FOR EXTERNAL USERS
1/11 Sürüm Numarası Değişiklik Tarihi Değişikliği Yapan Erman Ulusoy Açıklama İlk Sürüm IDENTITY MANAGEMENT FOR EXTERNAL USERS You can connect EXTERNAL Identity Management System (IDM) with https://selfservice.tai.com.tr/
a, ı ı o, u u e, i i ö, ü ü
Possessive Endings In English, the possession of an object is described by adding an s at the end of the possessor word separated by an apostrophe. If we are talking about a pen belonging to Hakan we would
BBS 514 YAPISAL PROGRAMLAMA (STRUCTURED PROGRAMMING)
1 BBS 514 YAPISAL PROGRAMLAMA (STRUCTURED PROGRAMMING) 6 LECTURE 10: STRUCTURES Lecturer: Burcu Can BBS 514 - Yapısal Programlama (Structured Programming) Structures (Yapılar) A structure is a collection
AB surecinde Turkiyede Ozel Guvenlik Hizmetleri Yapisi ve Uyum Sorunlari (Turkish Edition)
AB surecinde Turkiyede Ozel Guvenlik Hizmetleri Yapisi ve Uyum Sorunlari (Turkish Edition) Hakan Cora Click here if your download doesn"t start automatically AB surecinde Turkiyede Ozel Guvenlik Hizmetleri
MM103 E COMPUTER AIDED ENGINEERING DRAWING I
MM103 E COMPUTER AIDED ENGINEERING DRAWING I ORTHOGRAPHIC (MULTIVIEW) PROJECTION (EŞLENİK DİK İZDÜŞÜM) Weeks: 3-6 ORTHOGRAPHIC (MULTIVIEW) PROJECTION (EŞLENİK DİK İZDÜŞÜM) Projection: A view of an object
WEEK 4 BLM323 NUMERIC ANALYSIS. Okt. Yasin ORTAKCI.
WEEK 4 BLM33 NUMERIC ANALYSIS Okt. Yasin ORTAKCI [email protected] Karabük Üniversitesi Uzaktan Eğitim Uygulama ve Araştırma Merkezi BLM33 NONLINEAR EQUATION SYSTEM Two or more degree polinomial
const objects & const member functions const objects ve const functions Data Member Initializer List Data Member Initializer List
const objects & const member functions Principle of Least Privilege: Bir software parcasina sadece kesin olarak ihtiyac duyulani ver. Bu yolla bir cok muhtemel hata yakalanabilir ve bu hatalardan sakinilabilinir
ATILIM UNIVERSITY Department of Computer Engineering
ATILIM UNIVERSITY Department of Computer Engineering COMPE 350 Numerical Methods Fall, 2011 Instructor: Fügen Selbes Assistant: İsmail Onur Kaya Homework: 1 Due date: Nov 14, 2011 You are designing a spherical
A UNIFIED APPROACH IN GPS ACCURACY DETERMINATION STUDIES
A UNIFIED APPROACH IN GPS ACCURACY DETERMINATION STUDIES by Didem Öztürk B.S., Geodesy and Photogrammetry Department Yildiz Technical University, 2005 Submitted to the Kandilli Observatory and Earthquake
Yüz Tanımaya Dayalı Uygulamalar. (Özet)
4 Yüz Tanımaya Dayalı Uygulamalar (Özet) Günümüzde, teknolojinin gelişmesi ile yüz tanımaya dayalı bir çok yöntem artık uygulama alanı bulabilmekte ve gittikçe de önem kazanmaktadır. Bir çok farklı uygulama
Ardunio ve Bluetooth ile RC araba kontrolü
Ardunio ve Bluetooth ile RC araba kontrolü Gerekli Malzemeler: 1) Arduino (herhangi bir model); bizim kullandığımız : Arduino/Geniuno uno 2) Bluetooth modül (herhangi biri); bizim kullandığımız: Hc-05
4. HAFTA BLM323 SAYISAL ANALİZ. Okt. Yasin ORTAKCI.
4. HAFTA BLM33 SAYISAL ANALİZ Okt. Yasin ORTAKCI [email protected] Karabük Üniversitesi Uzaktan Eğitim Uygulama ve Araştırma Merkezi BLM33 NONLINEAR EQUATION SYSTEM Two or more degree polinomial
BBM Discrete Structures: Midterm 2 Date: , Time: 16:00-17:30. Question: Total Points: Score:
BBM 205 - Discrete Structures: Midterm 2 Date: 8.12.2016, Time: 16:00-17:30 Ad Soyad / Name: Ögrenci No /Student ID: Question: 1 2 3 4 5 6 7 Total Points: 12 22 10 10 15 16 15 100 Score: 1. (12 points)
Exercise 2 Dialogue(Diyalog)
Going Home 02: At a Duty-free Shop Hi! How are you today? Today s lesson is about At a Duty-free Shop. Let s make learning English fun! Eve Dönüş 02: Duty-free Satış Mağazasında Exercise 1 Vocabulary and
YEDİTEPE ÜNİVERSİTESİ MÜHENDİSLİK VE MİMARLIK FAKÜLTESİ
ÖĞRENCİ NİN STUDENT S YEDİTEPE ÜNİVERSİTESİ STAJ DEFTERİ TRAINING DIARY Adı, Soyadı Name, Lastname : No ID Bölümü Department : : Fotoğraf Photo Öğretim Yılı Academic Year : Academic Honesty Pledge I pledge
Islington da Pratisyen Hekimliğinizi ziyaret ettiğinizde bir tercüman istemek. Getting an interpreter when you visit your GP practice in Islington
Islington da Pratisyen Hekimliğinizi ziyaret ettiğinizde bir tercüman istemek Getting an interpreter when you visit your GP practice in Islington Islington daki tüm Pratisyen Hekimlikler (GP) tercümanlık
econn (Supplier Portal) of the MANN+HUMMEL Group
econn (Supplier Portal) of the MANN+HUMMEL Group October 2016 1 econn CONNECTED FOR SUCCESS Support If you have any questions or technical issues during the registration please contact: Teknik sorularınız
Teknoloji Servisleri; (Technology Services)
Antalya International University Teknoloji Servisleri; (Technology Services) Microsoft Ofis Yazılımları (Microsoft Office Software), How to Update Office 365 User Details How to forward email in Office
Do not open the exam until you are told that you may begin.
ÖRNEKTİR ÖRNEKTİR ÖRNEKTİR ÖRNEKTİR ÖRNEKTİR OKAN ÜNİVERSİTESİ FEN EDEBİYAT FAKÜLTESİ MATEMATİK BÖLÜMÜ 03.11.2011 MAT 461 Fonksiyonel Analiz I Ara Sınav N. Course ADI SOYADI ÖĞRENCİ NO İMZA Do not open
YEDİTEPE ÜNİVERSİTESİ MÜHENDİSLİK VE MİMARLIK FAKÜLTESİ
MÜHENDİSLİK VE MİMARLIK FAKÜLTESİ STAJ DEFTERİ TRAINING DIARY Adı, Soyadı Name, Lastname : ÖĞRENCİ NİN STUDENT S No ID Bölümü Department : : Fotoğraf Photo Öğretim Yılı Academic Year : Academic Honesty
D-Link DSL 500G için ayarları
Celotex 4016 YAZILIM 80-8080-8081 İLDVR HARDWARE YAZILIM 80-4500-4600 DVR2000 25 FPS YAZILIM 5050-5555-1999-80 EX-3004 YAZILIM 5555 DVR 8008--9808 YAZILIM 80-9000-9001-9002 TE-203 VE TE-20316 SVDVR YAZILIM
Ad Soyad: İmza: Object-Oriented Programming Quiz 4 60dk. Kapalı kitap. Kapalı defter. Kapalı cep telefonu. Hesap makinesi yok.
Ad Soyad: İmza: Object-Oriented Programming Quiz 4 60dk. Kapalı kitap. Kapalı defter. Kapalı cep telefonu. Hesap makinesi yok. 21.12.2018 1. (30 puan) Aşağıda, aralarında herhangi bir kalıtım (inheritance)
Do not open the exam until you are told that you may begin.
OKAN ÜNİVERSİTESİ MÜHENDİSLİK-MİMARLIK FAKÜLTESİ MÜHENDİSLİK TEMEL BİLİMLERİ BÖLÜMÜ 2015.11.10 MAT461 Fonksiyonel Analiz I Arasınav N. Course Adi: Soyadi: Öğrenc i No: İmza: Ö R N E K T İ R S A M P L E
C++ Class larina baslangic. C++ Versus C Object-oriented Language C++ Structure dan Object Create etmek. Structure tanimlama.
C++ Class larina baslangic Object oriented programming language olarak kullanildiginda, programming in temel birimi class lardir Object lerin create edilmesinde blueprint gorevi gorur Class data (object
Matematik Mühendisliği - Mesleki İngilizce
Matematik Mühendisliği - Mesleki İngilizce Tanım - Definition Tanım nasıl verilmelidir? Tanım tanımlanan ismi veya sıfatı yeterince açıklamalı, gereğinden fazla detaya girmemeli ve açık olmalıdır. Bir
ZTM112 BİLGİSAYAR DESTETEKLİ ÇİZİM TEKNİĞİ
ZTM112 BİLGİSAYAR DESTETEKLİ ÇİZİM TEKNİĞİ Yrd.Doç.Dr.Caner KOÇ Ankara Üniversitesi Ziraat Fakültesi Tarım Makinaları ve Teknolojileri Mühendisliği Bölümü [email protected] Teknik çizim nedir? Bir çizim
"IF CLAUSE KALIPLARI"
"IF CLAUSE KALIPLARI" am / is / are doing have / has done can / have to / must / should be to do was / were did, was / were to do was / were doing had to do should do had done had been doing had had to
Squid i Follow X-Forwarded-For headers Yaması İle Patchlemek
/******************************************************** * Gökhan ALKAN * gokhan [at] enderunix [dot] org * EnderUNIX Yazılım Gelistirme Takımı * http://www.enderunix.org * * Sürüm : 1.0 * Tarih : 27.06.2006
abstract Sınıflar 1 Sınıf sınıf1 new class Ama aşağıdaki şekilde referans alınabilir;
abstract Sınıflar 1 Özet sınıflar ya da özet metotlar abstract anahtar sözcüğü kullanılarak tanımlanırlar. Bir temel sınıf içinde bildirilen abstract metotların içeriği boştur. Kendisinden yeni bir instance
"Şirket" Sunucusu ve Başarı Mobile Arasındaki HTTP Veri Aktarımı için Etkileşim Teknik Protokolü
"Şirket" Sunucusu ve Başarı Mobile Arasındaki HTTP Veri Aktarımı için Etkileşim Teknik Protokolü BAŞARI Mobile tarafından desteklenmektedir. 1. Genel Bakış Bu döküman ile Şirket Adı nın ve Basari Mobile
Delta Pulse 3 Montaj ve Çalıstırma Kılavuzu. www.teknolojiekibi.com
Delta Pulse 3 Montaj ve Çalıstırma Kılavuzu http:/// Bu kılavuz, montajı eksiksiz olarak yapılmış devrenin kontrolü ve çalıştırılması içindir. İçeriğinde montajı tamamlanmış devrede çalıştırma öncesinde
BBM Discrete Structures: Final Exam Date: , Time: 15:00-17:00
BBM 205 - Discrete Structures: Final Exam Date: 12.1.2017, Time: 15:00-17:00 Ad Soyad / Name: Ögrenci No /Student ID: Question: 1 2 3 4 5 6 7 8 9 10 11 Total Points: 6 16 8 8 10 9 6 8 14 5 10 100 Score:
Newborn Upfront Payment & Newborn Supplement
TURKISH Newborn Upfront Payment & Newborn Supplement Female 1: Bebeğim yakında doğacağı için bütçemi gözden geçirmeliyim. Duyduğuma göre, hükümet tarafından verilen Baby Bonus ödeneği yürürlükten kaldırıldı.
public static int Toplam int x, int y
static Kavramı 1 İçinde bulunduğu sınıftan nesne oluşturulmadan veya hiç bir nesneye referans olmadan kullanılabilen üyeler static olarak nitelendirilir. Metotlar ve alanlar static olarak tanımlanabilir.
Yaz okulunda (2014 3) açılacak olan 2360120 (Calculus of Fun. of Sev. Var.) dersine kayıtlar aşağıdaki kurallara göre yapılacaktır:
Yaz okulunda (2014 3) açılacak olan 2360120 (Calculus of Fun. of Sev. Var.) dersine kayıtlar aşağıdaki kurallara göre yapılacaktır: Her bir sınıf kontenjanı YALNIZCA aşağıdaki koşullara uyan öğrenciler
const objects & const member functions
const objects & const member functions Principle of Least Privilege: Bir yazılım parçasına sadece kesin olarak ihtiyac duyulan karadar erişim izni verilmelidir. Bu yolla bir çok muhtemel hata yakalanabilir
BBS 514 YAPISAL PROGRAMLAMA (STRUCTURED PROGRAMMING)
1 BBS 514 YAPISAL PROGRAMLAMA (STRUCTURED PROGRAMMING) LECTURE 3: ASSIGNMENT OPERATOR Lecturer: Burcu Can BBS 514 - Yapısal Programlama (Structured Programming) 2 Lexical Elements (Sözcüksel Elemanlar)
Sınıf üyeleri: değişkenler (fields) and metotlar (methods) Değişkenler: nesne içerisindeki değişkenlerdir Temel veri tipi veya sınıf tipi
Görsel Programlama Metot Yeniden Tanımlama, Metot Aşırı Yükleme, Dinamik Metot Yükleme, Soyut Sınıflar, Soyut Metotlar, Arayüzler, Çoklu Kalıtım, Anonim Sınıflar ve java.lang.object Sınıflar Programcı
A LANGUAGE TEACHER'S PERSONAL OPINION
1. Çeviri Metni - 9 Ekim 2014 A LANGUAGE TEACHER'S PERSONAL OPINION Why is English such an important language today? There are several reasons. Why: Neden, niçin Such: gibi Important: Önemli Language:
BLM401 Mobil Cihazlar için ANDROID İşletim Sistemi. SQLite Veritabanı. BLM401 Dr.Refik SAMET
BLM401 Mobil Cihazlar için ANDROID İşletim Sistemi SQLite Veritabanı BLM401 Dr.Refik SAMET 1 SQLite açık kaynak kodlu; GİRİŞ (1/4) sunucu gerektirmeyen; konfigürasyon ayarları gerektirmeyen; platformdan
HTML 4. Bölüm. Doç. Dr. İsmail Rakıp Karaş Dersin Course Page:
HTML 4. Bölüm Doç. Dr. İsmail Rakıp Karaş www.ismailkaras.com [email protected] (Son Güncelleme: 18.02.2015) Dersin Course Page: www.ismailkaras.com/228 Çerçeveler (Frames) Çerçeve kullanımı her ne kadar
Present continous tense
Present continous tense This tense is mainly used for talking about what is happening now. In English, the verb would be changed by adding the suffix ing, and using it in conjunction with the correct form
Bölüm 4: İş Parçacıkları. Operating System Concepts with Java 8 th Edition
Bölüm 4: İş Parçacıkları 14.1 Silberschatz, Galvin and Gagne 2009 Bölüm 4: İş Parçacıkları Genel Bakış Çoklu İş Parçacığı Modelleri İş Parçacığı Kütüphaneleri İş Parçacıkları ile İlgili Meseleler İşletim
#include <stdio.h> int main(void) { float sayi; float * p; p = &sayi; printf("deger girin:"); scanf("%f", p); printf("girilen deger:%f\n", *p);
Ege University Electrical and Electronics Engineering Introduction to Computer Programming Laboratory Lab 11 - Pointers 1) Pointer syntax. Declare a variable and a pointer with same data type. Assign variable
Seri kablo bağlantısında Windows95/98/ME'ten Windows 2000'e bağlantı Windows95/98/ME - NT4 bağlantısına çok benzer.
Seri kablo bağlantısında Windows95/98/ME'ten Windows 2000'e bağlantı Windows95/98/ME NT4 bağlantısına çok benzer. Direkt Kablo desteğini Windows95/98'e yükledikten sonra, Windows95 for Direct Cable Client
FIHI MA-FIH - NE VARSA ONUN ICINDE VAR BY MEVLANA CELALEDDIN RUMI
Read Online and Download Ebook FIHI MA-FIH - NE VARSA ONUN ICINDE VAR BY MEVLANA CELALEDDIN RUMI DOWNLOAD EBOOK : FIHI MA-FIH - NE VARSA ONUN ICINDE VAR BY MEVLANA Click link bellow and free register to
HIGH SPEED PVC DOOR INSTALLATION BOOK
HIGH SPEED PVC DOOR INSTALLATION BOOK HIZLI PVC KAPI MONTAJ KLAVUZU MODEL FUD 2015.01 MONTAJ KLAVUZU/INSTALLATION BOOK INTRODUCTION The information contained in this manual will allow you to install your
THE IMPACT OF AUTONOMOUS LEARNING ON GRADUATE STUDENTS PROFICIENCY LEVEL IN FOREIGN LANGUAGE LEARNING ABSTRACT
THE IMPACT OF AUTONOMOUS LEARNING ON GRADUATE STUDENTS PROFICIENCY LEVEL IN FOREIGN LANGUAGE LEARNING ABSTRACT The purpose of the study is to investigate the impact of autonomous learning on graduate students
BMH-303 Nesneye Yönelik Programlama
BMH-303 Nesneye Yönelik Programlama Kurucu metotlar (constructors) ve statik deyimi Dr. Musa ATAŞ Siirt Üniversitesi Bilgisayar Mühendisliği Kurucu Metotlar (Constructors) Kurucu metot çeşitleri Varsayılan
Bölüm 6. Diziler (arrays) Temel kavramlar Tek boyutlu diziler Çok boyutlu diziler
Bölüm 6 Diziler (arrays) Temel kavramlar Tek boyutlu diziler Çok boyutlu diziler Chapter 6 Java: an Introduction to Computer Science & Programming - Walter Savitch 1 Genel Bakış Dizi: Hepsi aynı türde
ÖRNEKTİR - SAMPLE. RCSummer Ön Kayıt Formu Örneği - Sample Pre-Registration Form
RCSummer 2019 - Ön Kayıt Formu Örneği - Sample Pre-Registration Form BU FORM SADECE ÖN KAYIT FORMUDUR. Ön kaydınızın geçerli olması için formda verilen bilgilerin doğru olması gerekmektedir. Kontenjanımız
FINITE AUTOMATA. Mart 2006 Ankara Üniversitesi Bilgisayar Mühendisliği 1
FINITE AUTOMATA Mart 2006 Ankara Üniversitesi Bilgisayar Mühendisliği 1 Protocol for e-commerce using e-money Allowed events: P The customer can pay the store (=send the money- File to the store) C The
Yarışma Sınavı A ) 60 B ) 80 C ) 90 D ) 110 E ) 120. A ) 4(x + 2) B ) 2(x + 4) C ) 2 + ( x + 4) D ) 2 x + 4 E ) x + 4
1 4 The price of a book is first raised by 20 TL, and then by another 30 TL. In both cases, the rate of increment is the same. What is the final price of the book? 60 80 90 110 120 2 3 5 Tim ate four more
KIMSE KIZMASIN KENDIMI YAZDIM BY HASAN CEMAL
KIMSE KIZMASIN KENDIMI YAZDIM BY HASAN CEMAL DOWNLOAD EBOOK : KIMSE KIZMASIN KENDIMI YAZDIM BY HASAN CEMAL Click link bellow and free register to download ebook: KIMSE KIZMASIN KENDIMI YAZDIM BY HASAN
HOW TO MAKE A SNAPSHOT Snapshot Nasil Yapilir. JEFF GOERTZEN / Art director, USA TODAY
HOW TO MAKE A SNAPSHOT Snapshot Nasil Yapilir JEFF GOERTZEN / Art director, USA TODAY HEADLINE: How many minutes a day do you or someone else walk your dog? 0 minutes 13% 1-19 minutes 24% 20-39 minutes
12. HAFTA BLM323 SAYISAL ANALİZ. Okt. Yasin ORTAKCI. [email protected]
1. HAFTA BLM33 SAYISAL ANALİZ Okt. Yasin ORTAKCI [email protected] Karabük Üniversitesi Uzaktan Eğitim Uygulama ve Araştırma Merkezi DIVIDED DIFFERENCE INTERPOLATION Forward Divided Differences
KALEIDOSCOPES N.1. Solo Piano. Mehmet Okonşar
KALEIDOSCOPES N.1 Solo Piano Mehmet Okonşar Kaleidoscopes, bir temel ses dizisi üzerine kurulmuş ve bunların dönüşümlerini işleyen bir dizi yapıttan oluşmaktadır. Kullanılan bu temel ses dizisi, Alban
Binnur Kurt [email protected]. Bilgisayar Mühendisliği Bölümü İstanbul Teknik Üniversitesi. C++ ile Nesneye Dayalı Programlama 1
ÇOK ŞEKİLLİLİK Binnur Kurt [email protected] Bilgisayar Mühendisliği Bölümü İstanbul Teknik Üniversitesi C++ ile Nesneye Dayalı Programlama 1 Sınıf Yapısı Kalıtım Çok Şekillilik C++ ile Nesneye Dayalı
İŞLETMELERDE KURUMSAL İMAJ VE OLUŞUMUNDAKİ ANA ETKENLER
ANKARA ÜNİVERSİTESİ SOSYAL BİLİMLER ENSTİTÜSÜ HALKLA İLİŞKİLER VE TANITIM ANA BİLİM DALI İŞLETMELERDE KURUMSAL İMAJ VE OLUŞUMUNDAKİ ANA ETKENLER BİR ÖRNEK OLAY İNCELEMESİ: SHERATON ANKARA HOTEL & TOWERS
1 I S L U Y G U L A M A L I İ K T İ S A T _ U Y G U L A M A ( 5 ) _ 3 0 K a s ı m
1 I S L 8 0 5 U Y G U L A M A L I İ K T İ S A T _ U Y G U L A M A ( 5 ) _ 3 0 K a s ı m 2 0 1 2 CEVAPLAR 1. Tekelci bir firmanın sabit bir ortalama ve marjinal maliyet ( = =$5) ile ürettiğini ve =53 şeklinde
İZDÜŞÜM. İzdüşümün Tanımı ve Önemi İzdüşüm Metodları Temel İzdüşüm Düzlemleri Noktanın İzdüşümü Doğrunun İzdüşümü Düzlemlerin İz Düşümleri
ÖĞR. GÖR.ÖMER UÇTU İZDÜŞÜM İzdüşümün Tanımı ve Önemi İzdüşüm Metodları Temel İzdüşüm Düzlemleri Noktanın İzdüşümü Doğrunun İzdüşümü Düzlemlerin İz Düşümleri İzdüşümün Tanımı ve Önemi İz düşüm: Bir cismin
SBR331 Egzersiz Biyomekaniği
SBR331 Egzersiz Biyomekaniği Açısal Kinematik 1 Angular Kinematics 1 Serdar Arıtan [email protected] Mekanik bilimi hareketli bütün cisimlerin hareketlerinin gözlemlenebildiği en asil ve kullanışlı
Arýza Giderme. Troubleshooting
Arýza Giderme Sorun Olasý Nedenler Giriþ Gerilimi düþük hata mesajý Þebeke giriþ gerilimi alt seviyenin altýnda geliyor Þebeke giriþ gerilimi tehlikeli derecede Yüksek geliyor Regülatör kontrol kartý hatasý
Cases in the Turkish Language
Fluentinturkish.com Cases in the Turkish Language Grammar Cases Postpositions, circumpositions and prepositions are the words or morphemes that express location to some kind of reference. They are all
Neyzen olabilmek için en önemli özellik; sabretmeyi bilmektir. In order to be a neyzen the most important thing is to be patient.
www.neyzen.com NEY METODU SAYFA 033 NEY METHOD PAGE 033 Yücel Müzik İKİNCİ DEVRE SESLER Öğreneceğimiz NEVÂ, NÎM HİCÂZ, ÇÂRGÂH, SEGÂH, KÜRDÎ, DÜGÂH ve RAST seslerinin tümünü üflerken, aşîrân perdesinin
Kalıtım (Inheritance)
Kalıtım (Inheritance) Kocaeli Üniversitesi Kalıtım (Inheritance) Kodların çok kez kullanımı (Software reusability) Mevcut Sınıflardan Yeni Sınıflar Oluşturma Mevcut sınıfın değişken ve fonksiyonları kullanılabilir.
Makbul Re y Tefsirinin Yöneldiği Farklı Alanlar. The Different Fields Twords That The Commentary By Judgement Has Gone
Ahmet ALABALIK *1 Özet Bilindiği üzere re y tefsiri makbul ve merdut olmak üzere iki kısma ayrılır. Bu makalede makbul olan re y tefsirlerindeki farklı yönelişleri ele aldık. Nitekim re y tefsiri denildiğinde
1. English? a. She is b. Is c. He d. Is she. 1. This is an office, and tables. a. those are b. that are c. these d. that is. 1. This is girlfriend.
1. English? a. She is b. Is c. He d. Is she 1. This is an office, and tables. a. those are b. that are c. these d. that is 1. This is girlfriend. a. hers b. to him c. of her d. his 1. There are people
Bilişim Enstitüsü ++ Bilişim Enstitüsü ++ Bilişim Enstitüsü ++ Bilişim Enstitüsü ++ Bilişim Enstitüsü ++ Bilişim Enstitüsü ++ Bilişim Enstitüsü
Ders 5 Miras Alma Inheritance (Miras) Eski sınıflardan yeni sınıflar yaratılmasıdır. Yeni (türetilmiş) sınıf, eski (kök) sınıfın özellik ve davranışlarını gösterir. Türetilmiş (Derived) sınıf, kök (base)
ENG ACADEMIC YEAR SPRING SEMESTER FRESHMAN PROGRAM EXEMPTION EXAM
ENG111 2016-2017 ACADEMIC YEAR SPRING SEMESTER FRESHMAN PROGRAM EXEMPTION EXAM Exam Type Date / Classes / Time Written Thursday, September 22 nd, 2016 Classes & Time to be announced on September 20th.
Keyestudio SHT31 Temperature and Humidity Module / SHT31 Sıcaklık ve Nem Modülü
Keyestudio SHT31 Temperature and Humidity Module / SHT31 Sıcaklık ve Nem Modülü Overview / Genel Bakış This module mainly uses the SHT31 temperature and humidity sensor, which belongs to the SHT3X series
BİL-142 Bilgisayar Programlama II
BİL-142 Bilgisayar Programlama II (C/C++) Hazırlayan: M.Ali Akcayol Gazi Üniversitesi Bilgisayar Mühendisliği Bölümü Konular Giriş Sınıflar, Nesneler, Fonksiyon ve Veri Üyeleri Sınıf ve Fonksiyon Üyeleri
TEST RESULTS UFED, XRY and SIMCON
TEST RESULTS UFED, XRY and SIMCON Test material : SIM card Tested software : UFED 3.6, XRY 6.5, SIMcon v1.2 Expected results : Proper extraction of SMS messages Date of the test : 02.04.2013 Note : The
Dersin Türü (Course Type) Zorunlu (Compulsory)[Χ] Seçmeli (Elective) [ ]
Programın Adı (Program Name) Kodu (Course Code) CS 102 Molecüler Biyoloji ve Genetik (Molecular Biology and Genetics) Adı (Course Name) Türü (Course Type) Zorunlu (Compulsory)[Χ] Seçmeli (Elective) [ ]
Konforun Üç Bilinmeyenli Denklemi 2016
Mimari olmadan akustik, akustik olmadan da mimarlık olmaz! Mimari ve akustik el ele gider ve ben genellikle iyi akustik görülmek için orada değildir, mimarinin bir parçası olmalı derim. x: akustik There
K12NET ÖĞRENCİ-VELİ PORTALI KULLANIMI USE OF K12NET STUDENT-PARENT PORTAL
K12NET ÖĞRENCİ-VELİ PORTALI KULLANIMI USE OF K12NET STUDENT-PARENT PORTAL 1. K12NET i İnternet Explorer 7, 8 ya da 9 sürümlerinde kullanınız. Firefox, Google Chrome vb. tarayıcılarda açmayınız. Use K12NET
INTRODUCTION TO JAVASCRIPT JAVASCRIPT JavaScript is used in millions of Web pages to improve the design, validate forms, detect browsers, create cookies, and much more. JavaScript is the most popular scripting
5İ Ortak Dersler. İNGİLİZCE II Okutman Aydan ERMİŞ
Listmania Part 2 Ünite 12 5İ Ortak Dersler İNGİLİZCE II Okutman Aydan ERMİŞ 1 Ünite 12 LISTMANIA PART 2 Okutman Aydan ERMİŞ İçindekiler 12.1. PRESENT PERFECT & PAST SIMPLE... 4 12.1.1. Review of verb forms...
ÖNEMLİ PREPOSİTİONAL PHRASES
ÖNEMLİ PREPOSİTİONAL PHRASES Bu liste YDS için Önemli özellikle seçilmiş prepositional phrase leri içerir. 74 adet Toplam 74 adet İngilizce Türkçe Tür 1. with the help -ın yardımıyla with the aid -ın yardımıyla
AİLE İRŞAT VE REHBERLİK BÜROLARINDA YAPILAN DİNİ DANIŞMANLIK - ÇORUM ÖRNEĞİ -
T.C. Hitit Üniversitesi Sosyal Bilimler Enstitüsü Felsefe ve Din Bilimleri Anabilim Dalı AİLE İRŞAT VE REHBERLİK BÜROLARINDA YAPILAN DİNİ DANIŞMANLIK - ÇORUM ÖRNEĞİ - Necla YILMAZ Yüksek Lisans Tezi Çorum
BMH-303 Nesneye Yönelik Programlama
BMH-303 Nesneye Yönelik Programlama this anahtar kelimesi ve kalıtım Dr. Musa ATAŞ Siirt Üniversitesi Bilgisayar Mühendisliği this kelimesinin kullanım yerleri Aktif sınıfın örneğine referans vermek için
Hi-Res Audio/DNC Headset MDR-NC750
Kullanım kılavuzu Hi-Res Audio/DNC Headset MDR-NC750 İçindekiler Başlarken... 3 Giriş... 3 Genel bakış... 3 Temel konuları öğrenme...4 Mikrofonlu kulaklık setini takma... 4 Mikrofonlu kulaklık setinizi
Object-Oriented Oriented Design (OOD) Procedure Based Programlama. OOD Ana Ozellikleri
Procedure Based Programlama Procedural Programming Subprograms, functions/procedures kullanilmak suretiyle programi kisimlara ayirmak. Programlama karmasikligi procedure lar icinde gizlenir Data karmasikligi
The statement. const Time noon( 12, 0, 0 );
1 - const (Constant) Objects and const Member Functions Some objects need to be modifiable and some do not. You may use keyword const to specify that an object is not modifiable and that any attempt to
KONTAKSĐ. Bitirme Ödevi. Metin Kaplan 040020377 Ferhat Karakoç 040000606. Bölüm : Bilgisayar Mühendisliği Anabilim Dalı: Bilgisayar Bilimleri
ĐSTANBUL TEKNĐK ÜNĐVERSĐTESĐ ELEKTRĐK-ELEKTRONĐK FAKÜLTESĐ KONTAKSĐ Bitirme Ödevi Metin Kaplan 040020377 Ferhat Karakoç 040000606 Bölüm : Bilgisayar Mühendisliği Anabilim Dalı: Bilgisayar Bilimleri Danışman
Sample IELTS Task 2 scoring band 6
Merhaba, Aşağıda ortalama 6 seviyesinde bir öğrencinin IELTS Academic Writing Task 2 için yazdığı Essay i ve her paragraph ile ilgili yorumları bulacaksınız. IELTS WRITING TASK 2 You should spend about
If you have any issue in outlook mail account like spam mail, mail send or receive issues, mail delivery problem, mail sending too late and.
Sign in oturum aç If you have any issue in outlook mail account like spam mail, mail send or receive issues, mail delivery problem, mail sending too late Sign in others oturum problem aç then call our
