inheritance

Extend System.Web.HttpContext.User

I would like to extend the System.Web.HttpContext.User object (ASP.NET/VB.NET) so that it contains other fields besides just Name. I understand I can create an object that inherits the System.Security.Principal.GenericPrincipal class, but how do I store that in the Current.User object in a usable fashion. ie, I can do something like Curr...

Hibernate Table per Hierarchy How to

I would like to use hibernate to contain a hierarchy of objects, however the discriminator column is a foreign key to another table that contains the CODE defining the subclass type. Is it possible to specify the code from the joined table as the discriminator, or do I have to use the key values and hope the keys stay consistent? e.g...

easiest way to make a class inherit constructors (C#)

Yeah, sorry about asking a stupid n00b question. So I have a C# program. I have a class class foo { public int bar, wee, someotherint, someyetanotherint; public foo() { this.bar = 1: this.wee = 12; this.someotherint = 1231; this.someyetanotherint = 443; } } And I want to make a cla...

Discovering which CSS rule is responsible for the format of any element

I want to click / look at on an html element and find out which css rule is responsible for which format property. i.e. I want to know the font's come from body{ } the color from h { } and the padding from #headercontainer Is there a way of doing this? I've tried firebug and cssedit (both of which are very cool) but can't see wher...

Java Generics, extended Generics and abstract classes

I've got the following classes set up: public abstract class Process<T,S> { ... } public abstract class Resource<T, S extends Process<T, S>> { protected S processer; ... } public class ProcessImpl<EventType1, EventType2> { ... } public class ResourceImpl extends Resource<EventType1, ProcessImpl> { processer = new ...

PyQt - QLabel inheriting

Hello, i wanna inherit QLabel to add there click event processing. I'm trying this code: class NewLabel(QtGui.QLabel): def __init__(self, parent): QtGui.QLabel.__init__(self, parent) def clickEvent(self, event): print 'Label clicked!' But after clicking I have no line 'Label clicked!' EDIT: Okay, now I'm usi...

Why is PERSON not a ref class???

I don't understand why compiler thinks PERSON is NOT a ref class: : error C2811: 'Runner' : cannot inherit from 'Person', a ref class can only inherit from a ref class or interface class I tried.... adding mscorlib.dll to the header files: #using..etc...<> - didn't work. making Person an abstract class - didn't work (Im gla...

while extending any class, which class (child or parent) size get larger logically.

hi all, i m in a confusion that while extending any class, which class (child or parent) size get larger logically. thanks in advance ...

Is there a way to "delete" a pure virtual function?

I have an abstract class with a couple pure virtual functions, and one of the classes I derive from it does not use one of the pure virtual functions: class derivative: public base { public: int somevariable; void somefunction(); }; anyways, when I try to compile it, I get an error (apparently a class is still considered abstr...

Why can't I access a protected member from an instance of a derived class?

I haven't done C++ in a while and can't figure out why following doesn't work: class A { protected: int num; }; class B : public A { }; main () { B * bclass = new B (); bclass->num = 1; } Compiling this produces: error C2248: 'A::num' : cannot access protected member declared in class 'A' Shouldn't protected members be ...

Are implicity/explicit conversion methods inherited in C#?

Hello all, I'm not sure what I'm doing wrong here. I have a generic class, which is basically a glorified integer, with a few methods for certain string formatting, as well as into/from string and int conversions: public class Base { protected int m_value; ... // From int public static implicit operator Base(int Value)...

Virtual Calls using address of pure virtual member. Is it legal?

Hello Group, I read sometime back (probably on c.l.c++.moderated) that virtual function calls can be templatized. I tried something on the following lines. #include <iostream> template<class T, class FUN> void callVirtual(T& t, FUN f){ (*t.*f)(); } struct Base{ virtual ~Base(){} virtual void sayHi()=0; }; struct D...

Problems with parent / inheritance in PHP

EDIT: I got this working now. I have updated the code: I've looked at a few examples in here, and they all look logical. But I can't get it to work. I have a class that extends my Data Access Layer (DAL). I would like to call parent class to retrieve DB results. What am I doig wrong? DAL class class DAL { protected $username; /...

how to remove all inherited CSS formatting for a table?

I have a table which has a certain style due to the css file for the page (it has blue borders, etc...). Is there a simple way to remove the css for that specific table? I was thinking something along the lines of a command like style="nostyle" Does anything like this exist? ...

Why does C# take value from overridden property instead of the overriding property?

I would suspect the code below to output: (I am a SmartForm object and using the method in SmartForm).xml instead, however, it outputs: (I am a SmartForm object and using the method in Item).xml Why is that? How can I force C# to take the value from the overriding property? That is why I am overriding the property. using Sys...

c++ inheritance Qt problem qstring

I have this following code: template <class T> bool loadCSV (const QString &filename, map<T,int> &mapping){ QFile boxfile; boxfile.setFileName(filename); QString line; QStringList list; if (!boxfile.open(QIODevice::ReadOnly)){ cout << "Could not open box data file." << endl; return false; } QTextS...

C#: From base class, get drived type?

Let's say we've got these two classes: public class Derived : Base { public Derived(string s) : base(s) { } } public class Base { protected Base(string s) { } } How can I find out from within the ctor of Base that Derived is the invoker? This is what I came up with: public class Derived : Base { public ...

How can I use generics to put this method in the parent class?

I have a number of plural item classes which each have a collection of singular item classes, like this: public class Contracts : Items { public List<Contract> _collection = new List<Contract>(); public List<Contract> Collection { get { return _collection; } ...

Inheritance issue when wrapping (inheriting) from a C++ library

The library I'm using has class G and class S which inherits G. I needed to add functionality to them, so I wrapped G and S, rather I inherited from them making Gnew and Snew respectively. So, my inheritance is: G --> Gnew | v S --> Snew But, I want to use Gnew in Snew and when I try to include the Gnew header...

Why does this derived class need to be declared as a friend?

I'm learning C++ on my own, and I thought a good way to get my hands dirty would be to convert some Java projects into C++, see where I fall down. So I'm working on a polymorphic list implementation. It works fine, except for one strange thing. The way I print a list is to have the EmptyList class return "null" (a string, not a pointer)...