downcast
Should I avoid downcasting by any means when using factory pattern?
I\'m worki开发者_C百科ng on a server project that implements a proprietary protocol. The server is implement with factory pattern in C++, and we\'re now facing the problem of downcasting.[详细]
2023-03-07 10:02 分类:问答Why can't I downcast this object in Java?
I have this method: private Message getMessage(DataInputStream in) throws IOException { CommandEnum caption = CommandEnum.valueOf(in.readUTF());[详细]
2023-03-05 15:10 分类:问答Why is a static_cast from a Pointer to Base to a Pointer to Derived "invalid?"
So I have this code: Node* SceneGraph::getFirstNodeWithGroupID(const int groupID) { return static_cast<Node*>(mTree->getNode(groupID));[详细]
2023-03-01 16:00 分类:问答How to avoid downcasting when trying to extend a Java object
I get several objects of type Foo from a call to an external API. Locally I want to process those objects with a little added information so I have a subclass FooSon that adds those extra fields. How[详细]
2023-02-19 21:18 分类:问答java: "downcasting" to new object / opposite of slicing
Sorry, i really dont know how to make a headline for that question; maybe there is a name for what im trying to do that i dont know, but i can explain it with some code:[详细]
2023-02-19 03:18 分类:问答Downcasting a list of objects in C#
How can I downcast a list of objects so that each of the objects in the list is downcast to an object of a derived class?[详细]
2023-02-15 08:08 分类:问答where does downcasted object point to?
public class Animal{ int n = 5; public static void main(String[] args) { Animal a = new Animal(); Animal ah = new Horse();[详细]
2023-02-08 14:59 分类:问答can you downcast objects in java without declaring a new variable?
I was trying to do something like class O has a child E I declare the variable O xyz = new E(); but then if I call xyz.method(), I can only call those in class O\'s methods, not E\'s, so I can[详细]
2023-02-07 20:14 分类:问答C++ - faster downcasting children of a tree-node?
I have a simple hierarchy tree structure with a base class Node representing a node. A node could be of another specific type (subclassing).[详细]
2023-02-07 01:39 分类:问答C++ dynamic_cast - polymorphic requirement and downcasting
In the following code, while constructing obj in case 1, we construct a derived class object too, but its member functions are just inaccessible to obj. So while downcasting (i.e., in case 2), using o[详细]
2023-02-03 14:54 分类:问答