Questions tagged [derived]
429 questions
4
votes
2 answers
Component based architecture c++
I'm having trouble figuring out a way to make a component based engine architecture in c++. But i cant figure out a way to combine a vector of components with a class that derives from component.
I want to override components virtual function. But…

SundayBrowsing
- 49
- 1
- 8
4
votes
4 answers
List with different types
I'm new at the C# thing.... (.net 3.5)
I want a Dictionary to hold two different types of object, one of the type is generic. while iterating through the list, i will call methods like add and clone.
I have tried it with a base class and…

Anna
- 41
- 1
4
votes
6 answers
simulate virtual constructor in c++
In my application I have to derive some classes from a base one, the problem is that I want to enforce the derived classed to have 3 particular constructor implementation. As c++ don't have virtual pure constructor, it seemed quite desperate (I had…

chedi
- 298
- 3
- 12
4
votes
1 answer
Is there any way to access Base Class Property via Derived Class object directly in PHP
in php, is there any way to directly access any Base Class Property directly Via an object of a derived Class type.
For eg:
class a
{
public $name="Something";
function show()
{
echo $this->name;
}
};
class b extends…

Shashi
- 746
- 10
- 39
4
votes
1 answer
Returning new base class when the parent class shared pointer is the return type
Can you have a parent class shared pointer return type of a function and then return a new child class without it being a shared pointer? I'm not sure how shared pointers work in these situations, do they act like a regular pointer? Here is my…

Ben Dol
- 427
- 6
- 18
4
votes
3 answers
Array of derived classes, calling methods?
So I have an array of type Account, which is made up of Savings and Checking, which are derived from Account. Is it possible to get these to call their methods? Compiler only makes methods from base class visible, and I cannot get access to the…

Kefkamaydie
- 127
- 1
- 2
- 11
3
votes
4 answers
How do I call different methods for different class-types in a generic message-receiver?
Suppose I have a baseclass called IMessage, and lots of derived message classes.
In my program I have one method that receives all messages :
void ReceiveMessage(IMessage message)
{
}
and I'd like to call a specific method for each type of…

Pygmy
- 1,268
- 17
- 33
3
votes
1 answer
Entity Framework - Association From Derived Entities
I'm using the TPH (Table per Hierarchy) technique to map a set of entities.
DB Schema:
UserGroupLabelSpreads table having a "UserId", "GroupId" and "LabelId" nullable fields with some additional common fields.
DAL Objects:
- UserGroupLabelSpread…

nirpi
- 715
- 1
- 9
- 24
3
votes
2 answers
How to access the members of a derived class from another derived class?
I have a parent class and I have 2 publicly derived classes from that parent class. eg.
class Parent
| |
| |
| |
class derived1 …

rjm
- 31
- 4
3
votes
1 answer
Trying to inherit theme / style and applying additional triggers
I'm trying to work with, and understand XAML hierarchy for styles... in simple, a simple Textbox... seen all over the place for how to set the "disabled" background color based on the "IsEnabled" flag. Great, got that.
Now, I want to have another…

DRapp
- 47,638
- 12
- 72
- 142
3
votes
3 answers
Cross-DDL Extension of an Entityclass
What I want to archieve:
Service assembly (project) that holds EntityClasses - pure Data.
GUI assembly that extends those Entities for its own pourposes - Runtime information for GUI.
What I tried:
Derivation (Gui defines class ExtendedEntity :…

Steav
- 1,478
- 13
- 28
3
votes
1 answer
Python: __init__ of derived Singleton not called
I was toying around with the Singleton pattern and derivation. Specifically, I had this code:
class Singleton:
_instance = None
init_attempts = 0
def __init__(self):
self.init_attempts += 1
def __new__(cls, *args,…

Stefan Hartinger
- 48
- 4
3
votes
2 answers
forward declare derived class from template c++
I am having trouble working out some kinks in a design implementation. It goes something like this:
I have a template base class which has a conversion method.
// Foo.h
class Bar;
template
class Foo {
virtual const Bar…

Gary Doublé
- 436
- 4
- 17
3
votes
2 answers
deriving from a template
I'm stuck on the following and could use some help:
typedef unsigned short USHORT;
template
class Primative
{
protected:
DataType m_dtValue;
public:
Primative() : m_dtValue(0) {}
DataType operator=(const DataType…

kberson
- 439
- 1
- 3
- 8
3
votes
3 answers
'base' values may only be used to make direct calls to the base implementations of overridden members
Why can't I call the base implementation of f here:
type Base =
abstract f : int -> int -> int
default this.f (x : int) (y : int) : int = x + y
type Derived =
inherit Base
override this.f (x : int) (y : int) : int = base.f -x…

jon hanson
- 8,722
- 2
- 37
- 61