I have a function declared in my base class and specified as virtual, I am trying to re-declare it in a derived class but I'm getting a multiple declaration error.
Anyone know if I'm missing something here?
class Field {
public:
virtual void display() = 0;
virtual int edit() = 0;
virtual bool editable() cons...
I'm officially mentally retarded. [Let me explain]
I've never really given classes and their relationship any thought until today. I'm trying to figure out something that seems to be pretty obvious but since I'm stupid I can't see it.
Let's say I have a Core Class that will be extended from different files. How can children classes cal...
TL;DR:
Is there some way to add an abstract method to a base class that allows derived classes to override the method's return type, without the use of generics, and without the use of the new keyword?
I'm working on developing some custom templates for LLBLGen Pro. In the process, I refuse to change the default templates that LL...
Hi good people. I'm working in a web app framework, and part of it consists of a number of services, all implemented as singletons. They all extend a Service class, where the singleton behaviour is implemented, looking something like this:
class Service {
protected static $instance;
public function Service() {
if (isset...
Database has table X and tables An, Bn, Cn, Dn that inherits from X.
Process 1 queries periodically data from X.
Process 2 updates data in child tables. For example, to update tables An and Bn it creates new tables Am and Bm, loads data into them, locks in access exclusive An, Bn, drops An and Bn and alters Am and Bm to inherit X.
The...
I have a class that inherits from DrawingVisual. It declares a DependencyProperty which, when registered, should inherit its value from a parent.
I then create a parent-child relationship between two instances of this class. I set the parent DependencyProperty but the child's DependencyProperty does not return the parent's value. Can...
Can someone please show me and example of an abstract class in Java? Something with a real world application (rather than a text-book sample) would be preferable.
Thanks!
...
If you make an inherited class in C# (VS2005) do you need to explicitly call the constructor of the higher class, or will it be called automatically?
...
I have the following structure:
config
|-- groups
|-- rootgroup
|-- group1 (includes rootgroup)
|-- group2 (includes group1)
|-- group3 (includes rootgroup)
|-- users
|-- Fred (includes group3 and group2)
So inheritance tree for Fred will look like:
_Fred_
v v
group2 group3
v v
group1 ...
I'm trying to do Table per subclass: using a discriminator using NHibernate.Mapping.Attributes.
The hbm should look like this:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<subclass name="SalesReport" discriminator-value="SalesReport" extends="Report">
<join table="SalesReport">
<key foreign-key="FK_SalesReport_Doc...
In the header region of my base template (main.html), I've placed an HTML5 media player which pulls in content uploaded through my admin interface.
What I'm attempting to do is, when the tracks have been loaded once, have the media player remain unaffected by internal site navigation. In other words, the media player keeps playing but ...
I need a base class with a property where I can derive classes with the same property but different (compatible) types. The base Class can be abstract.
public class Base
{
public virtual object prop { get; set; }
}
public class StrBase : Base
{
public override string prop { get; set; } // compiler error
}
public class UseIt
{
...
Hello,
So, I have a base class which has a private locking object like so:
class A
{
private object mLock = new object();
public virtual void myMethod()
{
lock(mLock)
{
// CS
}
}
}
This locking object is used for most of A's operations... because they need to be thread safe.
Now, ...
public class Parent
{
public virtual Parent me()
{
return this;
}
}
public class Child : Parent
{
}
new Child().me() is returning a Parent object. What do i need to have it return the Child object itself (without using extension and generic)??
...
How do I choose a particular a method call in the inheritance chain?
class A
def boo; puts "A:Boo"; end
end
class B < A
def boo; super; puts "B:Boo"; end
end
class C < B
def boo; self.A.boo(???); puts "C:Boo"; end
end
Thus the output would be A:Boo, C:Boo
TIA,
-daniel
...
Hello, I have problem with mapping my classes by fluent nHibernate. My database looks look like this I have two tables Product and DocumentPossition. DocumentPossition knows about Product but product doesn't know about DP. Now on the database DocumentPossition has foreign key which is connected to Id of Product. DocumentPossition has it'...
I'm writing a simple platform game using javascript and html5. I'm using javascript in an OO manner. To get inheritance working i'm using the following;
// http://www.sitepoint.com/blogs/2006/01/17/javascript-inheritance/
function copyPrototype(descendant, parent) {
var sConstructor = parent.toString();
var aMatch = sConstruct...
For C# in VS2005, will calling this() in an inherited class cause the execution of the base constructor?
EDIT: How can I avoid having to re-write the x and y assignments? Note, I do not want the MyObject(int num) constructor to execute the base() contructor.
public class MyObject : MyParentObject {
int x;
int y;
int z;
public M...
Hi all,
I recently fumbled into a problem with an API and an implementation where the following type of code appeared:
The API is an abstract class:
public abstract class A {
public A sum(A a) {
System.out.println("A.sum(A) called");
return null;
}
}
The implementation is a simple class:
public class B extends A {
public B s...
Hi.
Here's what I thought of doing :
A - Structure {
Position
Name
}
B1 - Vehicle {
Fuel
}
B2 - Building {
-nothing-
}
foo - Car
foo2 - Truck
bar - Hospital
bar2 - Market
It's impossible to declare constructors like the following since A is not the direct base class :
foo(x,y,z):A(x,y,z)
bar(a,b,c):A(a,b,c)
So I tried doing...