polymorphism
To polymorph or to incapsulate, this is the question! (C++)
I need to store a polymorphic object (let\'s say Polygon) inside another object (let\'s say Simulation). At the same time I want to keep encapsulation of Simulation.[详细]
2023-03-21 10:14 分类:问答Pure virtual functions and unused arguments in child functions in C++
I have the following: class Parent { public: virtual bool foo(vector<string> arg1, vector<string> arg2) = 0;[详细]
2023-03-21 05:40 分类:问答Virtual Function Compared to Pointer Casting
The current version of some code I\'m using utilises a slightly odd way of acheiving something which I think could be acheived with polymorphism. More concretely we currently use something like[详细]
2023-03-21 03:10 分类:问答Using the same method name for two different method headers
I\'m experiencing a little issue, while working with Python/Django. I have a class, called \'Plantao\', and a method \'get_ultima_posicao\', which, I wanted to behave in the following way:[详细]
2023-03-21 03:04 分类:问答passing object for polymorphic lookup parameter in Rails find/where
Let\'s say I have: class C开发者_StackOverflowomment < ActiveRecord::Base belongs_to :commentable, :polymorphic => true[详细]
2023-03-20 23:12 分类:问答Problem in upcasting in Java?
Could someone please explain why this happening: class Apple { String type; setType(){ System.out.println(\"inside apple class\");[详细]
2023-03-20 19:26 分类:问答C++ Vector of Pointers, too many passes?
I\'ve been trying to figure out how to solve this seg-fault problem for hours now. I have a card game in C++, four players. A player (base class) can either be a computer or a human (derived classes)[详细]
2023-03-20 18:32 分类:问答C++ Inheritance and how to pass and maintain subclass data through a superclass
Alright, wasn\'t quite sure how to word the question and couldn\'t find any duplicates that I think really address this situation.[详细]
2023-03-20 15:22 分类:问答Rewritable dynamically-typed value as a class member
(This is sort of a long-winded question but I have summarized it at the bottom.) I want to write a class (in C++) that performs tests on objects of some unknown type deriving from a very skeletal bas[详细]
2023-03-20 13:22 分类:问答overloading a virtual function that is used in a base classes non-virtual function
Hey so i\'m trying to build the following member Functors of class ConcavePolygon, and i\'m getting Linker External symbol error for some reason:[详细]
2023-03-20 13:16 分类:问答