Podstrony
- Strona startowa
- Jason McC. Smith Elemental Design Patterns Addison Wesley Professional(2012)
- Cisco CCIE Fundamentals Network Design
- ebook OReilly Web Design Nutshell
- Teach Yourself Visual C 6 in 21 days
- Cisco Ccie Fundamental Network Design An
- Grebosz Symfonia.C Tom1 Wydanie czwarte(1999r.).(osloskop.net)
- adobe.photoshop.7.pl.podręcznik.uzytkownika.[osloskop.net]
- Adobe.Photoshop.7.PL.podręcznik.uzytkownika.[emulek.net]
- Dickson Gordon R Smoczy rycerz t.1
- Fowles John Mag (SCAN dal 900)
- zanotowane.pl
- doc.pisz.pl
- pdf.pisz.pl
- slaveofficial.htw.pl
[ Pobierz całość w formacie PDF ]
.It also defines a unique operation named Pay that would not berequired in either the Person superclass or the Customer subclass.If a superclass is not an abstract class and contains some implementation code,the subclass can inherit the code from the superclass or override it by providingits own code.This reuse of code is known as implementation inheritance and isthe most powerful form of reuse.Although implementation inheritance is very useful, it can lead to classdiagrams and code that are complex and difficult to read.You should ensurethat implementation inheritance is used appropriately and not overused.Note Visual Basic 6.0 does not support implementation inheritance, butVisual Basic.NET does.For more information, see Module 5, Object-OrientedProgramming in Visual Basic.NET, in Course 2373A, Programming withMicrosoft Visual Basic.NET (Prerelease). Module 4: Object-Oriented Design for Visual Basic.NET 23InterfacesTopic ObjectiveTo explain interfaces froman object-oriented point ofview.Interfaces only define the method signaturesLead-inClasses define the implementation of the code for theInterfaces are similar toInterface methodsabstract classes in that theycontain no implementationInterface inheritance means only the Interface iscode.inherited, not the implementation codePerson Employee{abstract}Public Sub Create( )Public Sub Create( ) implementation codePublic Sub Remove( ) &End Sub&Interfaces are similar to abstract classes.They define the method signaturesused by other classes but do not implement any code themselves.Interface inheritance means that only the method signatures are inherited andDelivery Tipthat any implementation code is not.You would need to create separate code inDo not try to explainthe appropriate inherited method of each derived class to achieve any requiredinterfaces from a COM pointfunctionality.Reuse is therefore more limited in interface inheritance asof view.Concentrate on thecompared to implementation inheritance because you must write code infact that an interface definesmultiple locations.only the method signaturesand not the implementationcode.24 Module 4: Object-Oriented Design for Visual Basic.NETPolymorphismTopic ObjectiveTo explain the object-oriented concept ofpolymorphism.The same operation behaves differently when applied toobjects based on different classesLead-inPolymorphism is an object-Often based on Interface inheritanceoriented concept that someVisual Basic developers willClasses inherit from interface base classbe familiar with.Each derived class implements its own version of codeClients can treat all objects as if they are instances ofthe base class, without knowledge of the derived classesPolymorphism is the ability to call the same method on multiple objects thathave been instantiated from different subclasses and generate differing behavior.This is often achieved by using interface inheritance.If two subclasses inheritthe same interface, each of them will contain the same method signatures as thesuperclass.Each one will implement the code in an individual way, allowingdifferent behavior to be created from the same method.Customer EmployeeCustomer EmployeeInherited Sub Create() Inherited Sub Create()Inherited Sub Create() Inherited Sub Create() do specific customer do specific employee do specific customer do specific employee code code code code& && &End Sub End SubEnd Sub End SubIn the above example, the Customer and Employee classes have inherited fromthe Person superclass.Each class implements its own version of the Createmethod differently, but, because they both inherit the same interface, a clientcould treat both classes the same. Module 4: Object-Oriented Design for Visual Basic
[ Pobierz całość w formacie PDF ]