Say I have a class BaseClass that implements IBaseClass
Then I have an interface IClass that inherits IBaseClass.
Then I have a class named class that implements IClass.
For example:
[ComVisible(true), InterfaceType(ComInterfaceType.IsDual), Guid("XXXXXXX")]
public interface IBaseClass
{
[PreserveSig]
string GetA()
}
[ComVisible...
I began writing an app using declarative_authorization (http://github.com/stffn/declarative%5Fauthorization) but I'm now wondering if it's the correct approach.
In my app, I was giving some Users a "customer" role, some an "administrator" role, and some a "superadmin" role. That was working fine, but I now realise that I need some field...
According to John C. Mitchell - Concepts in programming languages,
[...] Java guarantees that a
constructor is called whenever an
object is created. [...]
This is pointed as a Java peculiarity which makes it different from C++ in its behaviour. So I must argue that C++ in some cases does not call any constructor for a class ev...
Hello,
I have 2 objects Project and License. They both inherit from the object Entity (abstract class).
Now I have an extension method "GetNewId" that contains logic to get the next id in a list of entities.
I've defined this method as an extension method, but the problem is that List (which is also a list of entities) and List don't ...
I am using NHibernate to load a large tree of objects of different types. Mapping is implemented using table-per-subclass strategy. I defined a base class "Node" that has only a few fields (NodeId, ParentId, NodeType) and several subclasses that inherit from Node and add their own fields.
The implementation of this approach was straight...
I was having a look through the servlet-api.jar source code and found out (to my utter bewilderment) that javax.servlet.GenericServlet implements javax.servlet.ServletConfig.
Now, I don't boast to be an OOP scholar, but I do remember reading that although OOP provides the concept of inheritance, inheritance as a feature should be applie...
Hello,
If i have the following code example:
public class ClassBass
{
public int ID { get; set; }
public string Name { get; set; }
}
public class ClassA : ClassBass
{
public int JustNumber { get; set; }
public ClassA()
{
this.ID = 0;
this.Name = string.Empty;
this.JustNumber = string.Empty;...
I have two classes, WebServiceRequest and OrderRequest. Each class has properties. OrderRequest inherits from WebServiceRequest - like so:
public class WebServiceRequest
{
private string mAuthenticationToken;
public string AuthenticationToken
{
get { return mAuthenticationToken; }
set { mAuthenticatio...
Hi I just finished taking my final exam. There was a questions that said, "define the common ancestor problem in C++", and state what feature of the language is used to address this problem.
I don't remember ever learning about the common ancestor problem in class or ever hearing about it. However I wrote the following:
I said it had t...
I have a Person class which contains information like:
personId;
firstName;
lastName;
birthDate;
identityCardNumber;
address (contained Address object);
... a lot more data about the person.
Whenever I need to perform operations on a person’s data, an object from this class provides all the info I need.
Now, I also have a page w...
Dear developers,
I have a questions about C++ templates. More specifally, by using template arguments for inheritance.
I am facing strange behaviour in a closed-source 3rd party library. There is a C method
factoryReg(const char*, ICallback*)
which allows to register a subclass of ICallback and overwrite the (simplified) methods:
cl...
Take the situation listed in this question:
http://stackoverflow.com/questions/261407/mapping-multi-level-inheritance-in-hibernate/1883829
How would this mapping be done with Annotations rather than an hbm file?
...
Setup:
class A {
public:
void a() {}
};
class B {
public:
void b() {}
};
class C: public A, public B {
public:
void c() {}
};
What (I thought) I should be able to do:
C* foo = new C();
foo->b();
And I get the following linker error from GCC:
`... undefined reference to 'C::b(void)'`
If I use explicit scope re...
Hi
I have an aspect that writes something to the console on exception.
I have a base class that throws an exception on its constructor, and a derived class that have the aspect on its constructor.
I would expect that the derived class aspect on constructor will catch the base class exception, but it dont.
Is this by design? Is this a ...
Here is what I'd like to do:
function a() {
// ...
}
function b() {
// Some magic, return a new object.
}
var c = b();
c instanceof b // -> true
c instanceof a // -> true
b instanceof a // -> true
Is it possible? I can make b be an instance of a easily by hooking a into its prototype chain but then I have to do new b(), which is...
Perhaps my knowledge of inheritance and polymorphism isn't what I thought it was. Can anyone shed some light?
Setup (trivialization of problem):
class X {
};
class Y {
};
class Base {
public:
void f( X* ) {}
};
class Child: public Base {
public:
void f( Y* ) {}
};
Question: This should work, right?
int main( void ) {...
To some extent, this is more a thought exercise than a real problem, since I don't have enough CustomFS classes to be particularly bothered by just using copy paste. But I wonder if there's a better way.
Suppose I have several classes CustomFS, CustomFS2, etc., all of which inherit from FS, FS2, etc. FS/FS2/etc. all inherit from FSG, ...
I'm creating a Django app that uses some inheritance in it's model, mainly because I need to assign everything a UUID and a reference so I know what class it was. Here's a simplified version of the base class:
class BaseElement(models.Model):
uuid = models.CharField(max_length=64, editable=False, blank=True, default=lambda:unicode(...
I have two classes, named Post and Question. Question is defined as:
public class Question : Post
{
//...
}
My Question class does not override any members of Post, it just expresses a few other ones.
What I want to accomplish
I have an object of type Post, whose members are populated. Now, I want to convert it into a Question, so...
Hi,
I have a base class which contains an equal? method. I've then inherited that object and want to use the equal? method in the super class as part of the equal? method in the sub class.
class A
@a
@b
def equal?(in)
if(@a == in.a && @b == in.b)
true
else
false
end
end
...