polymorphism
C# - Call Method in Base Class
I have 2 classes: public class A { public void WriteLine(string toWrite) { Console.WriteLine(toWrite); }[详细]
2023-03-29 07:37 分类:问答Java, clever way to replace "if not null" statement?
I have a Vector full of longs. I would like to be able to always call getFirstElement() on a Vector and then perform an action, let\'s say addToOther开发者_如何学编程Vector(). I want to be able to no[详细]
2023-03-29 07:01 分类:问答empty interface(abstract class) for logical grouping of objects to avoid LSP violations
In the real world a square is a rectangle, but to a开发者_开发技巧 program this is not the case(LSP principle).is it considered an anti-pattern / poor programming to create a blank interface to logica[详细]
2023-03-28 13:08 分类:问答Rails Polymorphic association + fields_for
I\'m trying to wrap my head around how to set up this schema with polymorphic associations: a \"Document\" has one metadata object, but this can either be \"PDFMetaData\" or \"TXTMetaData\".[详细]
2023-03-28 07:12 分类:问答Is "inherited" the correct term to explain static method of superclass can be accessed by subclass?
Clarification: this question is not about access modifier Confirmed that B.m() and b.m() statements both works in the following code:[详细]
2023-03-28 06:30 分类:问答Subclass reference to Superclass Object
What is use of creating Subclass reference to Supercl开发者_C百科ass Object class A { /* ... */ }[详细]
2023-03-27 22:08 分类:问答Iterating over a collection with multiple types - how do I use type-specific attributes?
I want to iterate over a collection that contains objects of various types.If I want to use a common attribute, it\'s easy because I don\'t have to test for type -- they all respond.[详细]
2023-03-27 15:37 分类:问答Segmentation Fault while using STL
I am facing problem using STL library. I am attaching code snippet. // Store a class object in a vector.[详细]
2023-03-27 14:19 分类:问答Overloading difficulty with an extended sprite class. How is this wrong?
So I\'ve been working on a puzzle game using a sprite system I used fine previously and in my past projects have been fine when extending the class, however my code keeps throwing an error of[详细]
2023-03-27 10:26 分类:问答Provide array of derived objects to function that operates on base objects
Finding the appropriate title to this question is a little difficult for me, but here is my situation.Say I have a base class and a derived class, can I pass a function that takes a parameter of type[详细]
2023-03-27 10:17 分类:问答