امشب اومدم حال اساسی بهتون بدم
Inheritance Class Generator
This VB6 Add-in generates a subclass from a given class in your VB project. The "Inheritance Class Generator" supports multiple levels of inheritance. To leverage this capability,create a base class, subclass it, then subclass the subclass. Repeat! The thing to note is that you will use a certain syntax to access methods in various parts of the object hierarchy. See "cmdMulipleInheritance_Click" in the example provided. All the code is written for you. The following is from the "read me." In VB6, to "do inheritance" . . . 1. Create the base class -- CAnimal 2. Run the "Inheritance Class Generator" add-in to generate a new "CSubClass". 2.1 Notice that the new class "Implements" the base class interface. 2.2 "implementation inheritance" is accomplished thru delegation 2.3 Notice typecasting of the subclass instance pointer to the base class type in class_initialize. 2.4 This gives each subclass instance (CDog, CCat) access to the methods of the base class (CAnimal) 2.5 This is the little *magic ingredient* that most accounts lack. 2.6 The tool supports object return types for functions and properties. Commentary: Perhaps the important takeaway is that this solution is really a generic "design pattern" that is useful in other contexts and languages. I have seen authors describe this as "simulated inheritance" using a derisive tone. This is, well, just plain wrong. The code here is pretty similar, in logic, to what a compiler "does for you" in other languages. In addition, this design pattern is the solution for doing "multiple-inheritance" in Java/C#‎/VB6. In that case, I wouldn't call it "simulated multiple-inheritance," I'd call it a design that supports the feature in question. End of story. Understand that inheritance" is a purely abstract concept. If a design maps onto the concept, it is "real", and anyone who says differently, is confused by the difference between a concept and a given implementation of a concept in some product. Please note how much of the code in this example has a boilerplate quality. Not only can VB6 "do inheritance", but one could argue that the VB team could have added the keywords to the language in a few man-weeks of effort. They simply chose not to. Note that this design accomplishes the 2 main objectives of "inheritance": code reuse CAnimal = 100% reuse CCat, CDog = ~90-100% reuse polymorphism each subclass of the base can have its own subset of unique methods/data members base class methods can be overridden in the subclass method overloading can be accomplished with a little guile see "HowToDoFunctionOverLoading()" in CAnimal Therefore, the whole "VB doesn't do inheritance" thing was a bit of a red herring from day one. Let me say for historical completeness that this was clearly demonstrated at VBITS in 1997 when VB5 came out. I was at the session.

دانلود