I have an abstract class called Grouping. I have a subclass called GroupingNNA.
public class GroupingNNA : Grouping {
// blah blah blah
}
I have a List that contains items of type GroupingNNA, but is actually declared to contain items of type Grouping.
List<Grouping> lstGroupings = new List<Grouping>();
lstGroupings.Add(
new Grou...
Hi,
Is there away to not have a "cast" the top.First().Value() return to "Node", but rather have it automatically assume this (as opposed to NodeBase), so I then see extended attributes for the class I define in Node?
That is is there a way to say:
top.Nodes.First().Value.Path;
as opposed to now having to go:
((Node)top.Nodes.Fir...
I've seen this before but can't figure out what the correct term is. Basically, I'd like to create models for a specific subset of table data. E.g. (these are not the real classes)
class Person < ActiveRecord::Base
class Man < Person
<something here> :gender => 'male'
...
Hi,
Any see why I'm getting a "Argument 1: cannot convert from 'ToplogyLibrary.RelationshipBase' to 'TRelationship'" in the code below, in CreateRelationship() ?
public class TopologyBase<TKey, TNode, TRelationship>
where TNode : NodeBase<TKey>, new()
where TRelationship : RelationshipBase<TKey>, new()
{
// Properties
p...
As we can see, send method is not overloaded.
from socket import socket
class PolySocket(socket):
def __init__(self,*p):
print "PolySocket init"
socket.__init__(self,*p)
def sendall(self,*p):
print "PolySocket sendall"
return socket.sendall(self,*p)
def send(self,*p):
print "PolySo...
Hi,
I am an experienced .NET developer but new to EF - so please bear with me. I will use an example of a college application to illustrate my problem. I have these user roles:
Lecturer, Student, Administrator.
In my code I envisage working with these entities as distinct classes so e.g. a Lecturer teaches a collection of Students. An...
To implement reference counting we use an IUnknown-like interface and a smart pointer template class. The interface has implementation for all the reference-count methods, including Release():
void IUnknownLike::Release()
{
if( --refCount == 0 ) {
delete this;
}
}
The smart pointer template class has a copy constructor an...
If I have an abstract class in java named Foo and it has an implementor named Bar then I want to know the following.
lets say Foo looks something like
public abstract class Foo {
Service serviceFoo
...
}
And Bar is
public class Bar extends Foo {
...
}
Also, lets assume I have an instance with Foo, named foo, currently that...
I've begun diving into Django again and I'm having trouble finding the parallel to some common concepts from my life in C#. While using .NET MVC I very often find myself creating a base controller which will provide a base action implementation to take care of the type of stuff I want to do on every request, like retrieving user informat...
I'm trying to create a structure array which links input strings to classes as follows:
struct {string command; CommandPath cPath;} cPathLookup[] = {
{"set an alarm", AlarmCommandPath},
{"send an email", EmailCommandPath},
{"", NULL}
};
which will be used as follows:
CommandPath *cPath = NULL;
string input;
getline(cin, i...
Here the scenario: I have a unidirectional 1:N Relation from Person Entity to Address Entity. And a bidirectional 1:N Relation from User Entity to Vehicle Entity.
Here is the Address class:
@Entity
public class Address implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = Gene...
URL: Link (1)
According to this wesbite .. you cannot implement Abstract classes but derive from them. This makes sense and I have read this many times.
Like an interface, you cannot implement an instance of an abstract class, however you can implement methods, fields, and properties in the abstract class that can be used by the ch...
I have a base type that I want to inherit from, for all my DAO objects, but this member gets the error further down about not being defined:
type BaseDAO() =
member v.ExecNonQuery2(conn)(sqlStr) =
let comm = new MySqlCommand(sqlStr, conn, CommandTimeout = 10)
comm.ExecuteNonQuery |> ignore
comm.Dispose |> ign...
Consider this situation:
I get an object of type A which has the function f. I.e:
class A:
def f(self):
print 'in f'
def h(self):
print 'in h'
and I get an instance of this class but I want to override the f function but save the rest of the functionality of A. So what I was thinking was something of the sort:
clas...
Why is multiple inheritance not supported in most of programming language?
I could really use this feature to develop different layout of application?
...
I'm developing an AS3 application which has some memory leaks I can't find, so I'd like to ask some newbie questions about memory management.
Imagine I have a class named BaseClass, and some classes that extend this one, such as ClassA, ClassB, etc.
I declare a variable:
myBaseClass:BaseClass = new ClassA();
After a while, I use it...
I feel like the answer to this question is really simple, but I really am having trouble finding it. So here goes:
Suppose you have the following classes:
class Base;
class Child : public Base;
class Displayer
{
public:
Displayer(Base* element);
Displayer(Child* element);
}
Additionally, I have a Base* object which might poi...
In my database there are two three tables. The first one, table ABSTRACT, holds three columns
id, type, someText
This table contains all abstract information for the abstract class abstract. Now the two tables CONCRETEONE and CONCRETETWO contain all information for the concrete classes concreteOne and concreteTwo. Now I know I could ...
This code doesn't work, but hopefully you'll get what I'm trying to achieve here. I've got a Money class, which I've taken from http://www.noticeablydifferent.com/CodeSamples/Money.aspx, and extended it a little to include currency conversion.
The implementation for the actual conversion rate could be different in each project, so I d...
Typically i dont want to know the specifics of the cons of OOPs, but it felt kind of weird when I had an argument at an interview I attended recently. The question that was posted to me was to tell me one disadvantage of OOP (Object Oriented Programming). At that time, I felt OOP to be the most matured level of programming after the proc...