I have 3 tables in my database
Country
City
House
Country table looks like
CountryID
Name
City table looks like
CountryID
CityID
Name
House
CountryID
CityID
HouseID
Name
I use LINQ to SQL and the above tables become classes and have their properties etc.
Now I have my own abstract class called
Location
And cr...
Hi. Probably asking this shows that I don't have the convenient grasp on OOP, but...
How can I call a derived function from a base class? I mean, being able to replace one function from the base to the derived class.
Ex.
class a
{
public:
void f1();
void f2();
};
void a::f1()
{
this->f2();
}
/* here goes the a::f2() definit...
I am bubbling events in my application and so therefore using the bubble events method. As this method handles all sorts of bubbled events their is a switch or if statement within it to determine what sort of event we're dealing with. I was wondering if I could get around this by creating different versions of the event args class. So...
Hi
In Django application I have these models:
class DLL(models.Model):
prev = models.ForeignKey('self', related_name = 'prevItem', blank = True, null = True)
next = models.ForeignKey('self', related_name = 'nextItem', blank = True, null = True)
class Meta:
abstract = True
class SomeData(DLL):
name = models.TextField()
The pr...
In Scala, what does
trait A <: B
mean? Is it just the same as
trait A extends B
?
Edited to add: I'm familiar with the syntax for type parameters, and what <: means in that context. However, in the above example it would seem to me that A is the name of the trait being declared, not a type parameter.
...
I'm currently building a library to allow a wide variety of different minority games to be simulated. This involves agents choosing between two choices, say, A and B so the primary functionality of an agent is to choose. An agent wins a point for a turn in the game if it ends up in the minority group after all agents have chosen.
There ...
I've been googling and reading about this and didn't come up with an answer yet, maybe someone can help me with this.
I want my UserPile class to be able to access data members and class member functions from my CardPile class. I keep getting the error mention in the title. Could someone explain what is happening? The inheritance tut...
Hi Everyone,
I am wondering how to simulate Class Inheritance in JavaScript. I know class doesn't apply to JavaScript, the way we use is Functions to create objects and do the inheritance things through Prototype object.
For example, how do you convert this structure into JavaScript :
public class Mankind {
public string name;
...
What are some alternatives to inheritance?
...
Scenario
I have a single base class and 2 (possibly 3) other classes that derive from that base class.
//Base Class
class RateInstrument
{
public string Ric { get; set; }
public string Tenor { get; set; }
public double Rate { get; set; }
public DateTime Date { get; set; }
public double Price { get; set; }
...
I have the following graph:
OrderLine
OrderLineExtension
OrderLineExtensionA
OrderLineExtensionB
OrderLineExtensionC
OrderLine contains a Set of OrderLineExtension.
OrderLineExtension is defined as : @Inheritance(strategy = InheritanceType.JOINED) and is marked as an entity and is abstract
A table is creat...
I have an entity class and a subclass based on that entity:
@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class A
and
@Entity
public class B extends A
I need to issue a native query that uses a stored procedure on the base class (A) only. If I attempt it as follows:
entityManager.createNativeQuery("selec...
Consider the following snippet:
struct Base
{
virtual ~Base() {}
virtual void Foo() const = 0; // Public
};
class Child : public Base
{
virtual void Foo() const {} // Private
};
int main()
{
Child child;
child.Foo(); // Won't work. Foo is private in this context.
static_cast<Base&> (child).Foo(); // Okay. Foo is public ...
Hey,
I have 2 classes:
class Base
{
public:
virtual int Foo(int n);
virtual void Goo() = 0;
virtual ~Base() ;
};
class Derived : public Base
{
public:
int Add4Bytes;
void Goo();
int Foo(int n);
};
int Test(Base* b)
{
for (int i=0;i<5;++i)
{
b->Foo(i);
++b;
}
re...
Hi,
If a class Derived is inherited privately from a class Base and the Derived class has a friend function f(), so what members can f() access from Derived class and Base class.
class Base {
public:
int a;
protected:
int b;
private:
int c;
};
class Derived: private Base {
void friend f() {}
public:
int d;
...
I'd love to be able to do this:
class myInt : public int
{
};
Why can't I ?
Why would I want to? Stronger typing. For example, I could define two classes intA and intB, which let me do intA+intA or intB+intB, but not intA+intB.
"Ints aren't classes" so?
"Ints don't have any member data" Yes they do, they have 32 bits, or whatever....
How do you deal with having only single inheritance in java? Here is my specific problem:
I have three (simplified) classes:
public abstract class AbstractWord{
String kind; // eg noun, verb, etc
public String getKind(){ return kind; }
}
public class Word extends AbstractWord{
public final String word;
ctor...
...
I have a class, Deck, that contains a method called Shuffle.
I'm working on refactoring Deck to extend List<Card>, rather than having List<Card> Cards as a property. However, while Cards.OrderBy (a => Guid.NewGuid ()) worked, OrderBy (a => Guid.NewGuid ()) does not:
Error CS0103: The name 'OrderBy' does not exist in the current context...
I want to simulate derivation from a base class (which is unaccessible) using just an interface and an instance of the base class (as opposed to just deriving directly from the base class).
Let me try to explain better: I have an exposed interface and a (hidden) class implementation for it.
In another module, I create a 2nd implementat...
I have a css class rule:
.test{ text-align:center; font-family:Verdana; }
And i want to create another id rule (I hope It is right calling by "id rule" ):
#divNew1{ color: Red; }
#spanNew2{ color: Green; }
#pNew3{ color: Yellow; }
I have a lot of div elements. I want to pass .test class properties to other elements with only changi...