In my UI XAML I'm essentially inheriting from a class "BaseView" that contains functionality common to several forms, however this is preventing the designer from displaying the form: "Could not create instance of type BaseView". The code will compile and run, but it is frustrating not to be able to see the form in the Designer. Is ther...
Is there any way that I can create a new delegate type based on an existing one? In my case, I'd like to create a delegate MyMouseEventDelegate which would have the same functionality as EventHandler<MouseEventArgs>.
Why do I want this? To take advantage of compile-time type-checking, of course! This way, I can have two different delega...
When I have a given django model class like this:
class BaseClass(models.Model):
some_field = models.CharField(max_length = 80)
...
and some subclasses of it, for example
class SomeClass(BaseClass):
other_field = models.CharField(max_length = 80)
Then I know I can get the derived object by calling
base = BaseClass...
Okay this is a bit of a noobish question, but I ran across this today and it somewhat puzzles me WHY it would be this way.
Consider the following structure
Public Class Employee
Implements IPerson
Private _MyManager As Manager
Public Property MyManager() As Manager Implements IPerson.TheirLeader
Get
Return _...
I have some classes that are used as Singletons. They share some basic functionality and extend the same ancestor from a library which in turn isn't normally used as a Singleton.
If I put the common functionality in a base class that inherits from the common ancestor, I get a class which makes no sense to instantiate, so I made it abstr...
I am trying to call the "Run" function in a new thread. Right now, I have this code using openMP that doesn't actually run "Run" in a new thread. NOTE: I am not asking for help using OpenMP. This code was just a quick fix. I would prefer a CreateThread() method of going about this.
vector<ICommand*>* commands;
string strInput;
// For ea...
Hi.
Say I have an "abstract class" like this:
function AbstractClass() {
this.getImplementingName = function() {
return /* how do I get this? */;
}
}
and an implementation like
function ImplmentingClass() {
}
ImplmentingClass.prototype = new AbstractClass();
var impl = new ImplmentingClass()
var name = impl.getImp...
I have two classes A and B, where B is subclass of A and A is not abstract. Therefore I can have objects that are instance of A and objects that are instance of B (and therefore of A).
How can I distinguish objects that are only instance of A?
Sure, I can write something like "object instaceof A && !(object instance of B)" but this is...
Hello,
C# 2008
I am not sure how much work there is to inheriting from the web client class.
Currently I am using it in my project. And I can't change to anything else. The customer would like to have a timeout after a certain period of time. The web client doesn't have this.
So rather than re-invent the wheel, I am thinking of inhe...
I'm filling PDF applications using classes that represent the pdf. I have a property per textbox on the pdf and am using attributes to specify the pdf textbox that the propery maps to. All of my PDF's have the same properties, but the pdf's use different names for the textboxes. So, the only solution I could think of was to create a ...
I've just used it for the first time - consider:
IGameObject
void Update()
IDrawableGameObject : IGameObject
void Draw()
I had a level class which used DrawableGameObjects - I switched this to be IDrawableGameObject's instead to reduce coupling and aid in TDD.
However I of course lose the ability to call Update(..) without c...
I have this class
public class Address:Entity {
public virtual string Address1 { get; set; }
public virtual string Address2 { get; set; }
public virtual string City { get; set; }
public virtual string State { get; set; }
public virtual string Zip { get; set; }
public virtual string Phone { get; set; }
public ...
Let's say we have a class called MyClass.
public class MyClass
We also have an interface like so:
public interface MyInterface{
public string SomeFunction(int foo, string bar, short baz){}
}
We want this class to inherit from MyInterface.
public class MyClass: MyInterface
MyInterface has n properties, and i methods. How can I g...
I use the following function to detect values that belonged to an object's constructor instead of the object itself.
function isAPrototypeValue(object, key ) {
return !(object.constructor && object.constructor.prototype[key]);
}
this would work as follows:
Array.prototype.base_value = 'base'
var array = new Array;
array.custom_valu...
How can I make the following code work? I don't think I quite understand C# generics. Perhaps, someone can point me in the right direction.
public abstract class A
{
}
public class B : A
{
}
public class C : A
{
}
public static List<C> GetCList()
{
return new List<C>();
}
...
Hello!
Lets say I inherit a class, that has several public properties and/or methods, however I do not want them to be public properties/methods of my class - in other words, I want to make those properties protected properties of my class.
Can this be achieved?
I hope I was clear enough, if not please let me know, will try to explain...
I ran into a problem where after my class overrode a function of its base class, all of the overloaded versions of the functions were then hidden. Is this by design or am I just doing something wrong?
Ex.
class foo
{
public:
foo(void);
~foo(void);
virtual void a(int);
virtual void a(double);
};
class bar : public fo...
I am writing a .NET webservice (VB.NET). One of the methods DisplayChild() returns an object of type Child. Child is defined:
<Serializable()> _
Public Class Child
Inherits BaseClass
Property NotInInheritedProperties() as Object
...
End Property
End Class
and the BaseClass looks something like:
<Serializable()> _
Publ...
I can understand why you would need a class variable to keep track of things like the total number of objects that have been instantiated in that class.
And I can understand why you would need an instance variable to store attributes of a particular object in that class.
But class instance variables I just can't seem to justify.
As I ...
I have a basic class that derived subclasses inherit from, it carries the basic functions that should be the same across all derived classes:
class Basic {
public:
Run() {
int input = something->getsomething();
switch(input)
{
/* Basic functionality */
case 1:
doA();
break;
case 2:
...