Hi,
When I want to extend an existing Object I create my own and use inherits clause, and works fantastic... problem is when I want to use this new Object instead of the original, the populate part is a "pain".
is there any AUTO POPULATE way of doing this?
Original Object: Customer
My Object: CustomerWithGroup
public class CustomerWi...
Hi, all. I can't undestand why the bellow code need a cast to work. Someone can explain it?
class Base {
};
class Derived : public Base {
};
class Class {
public:
Derived member;
};
...
Derived obj;
Base *ptrObj = &obj; // ok, no cast needed
Derived Class::* ptr = &Class::member; // ok
Base Class::* ptr = &Class::member; // ...
The plugin (Nimble 0.3) I am using in my grails application, includes some controllers and associated actions. I want to change (slightly) some actions behavior, and I was wondering how I can achieve that.
Can I create a child controller that inherits from my plugin controller and override some of the action implementation?
Or, can I c...
I have a number of classes that reflect tables in a database. I would like to have a base class that has some basic functionality (say, it would have a "isDirty" flag), and a static array of strings with the column names as they appear in the database. The following code doesn't work but illustrates what I would like to do:
public cla...
I have the following class hierarchy:
public class Row : ICloneable, IComparable, IEquatable<Row>,
IStringIndexable, IDictionary<string, string>,
ICollection<KeyValuePair<string, string>>,
IEnumerable<KeyValuePair<string, string>>,
System.Collections.IEnumerable
{ }
public class SpecificRow : Row, IXmlSerializable,
...
Hi all. I'm getting some nasty segmentation faults through the g++ compiler on the following code. Any ideas on why this would happen and how to fix it would be great.
#include <iostream>
using namespace std;
class Base {
public:
Base() {}
virtual ~Base() {};
virtual int getNum(int) = 0;
};
class Derived: public Base {
public:
...
In the book "JavaScript the definitive guide 5 edition", section 9.2 Prototypes and Inheritance, I find the following words:
In the previous section, I showed that
the new operator creates a new, empty
object and then invokes a constructor
function as a method of that object.
This is not the complete story,
however. After c...
I'm trying to implement a validation framework in a base class for LINQ to SQL entities. The problem I'm having is getting the OnValidate event to fire properly.
The reason is that OnValidate is marked as partial so I can't provide a default implementation in the base class; it gets hidden by a new method declared by the LINQ to SQL cl...
Recently one of my friend asked me how to prevent class inheritance in C++. He wanted the compilation to fail.
I was thinking about it and found 3 answers. Not sure which is the best one.
1) Private Constructor(s)
class CBase
{
public:
static CBase* CreateInstance()
{
CBase* b1 = new CBase();
return b1;
}
private:
CBase(...
Hi,
I made a personnal class which inherits QMap:
class CfgMgr : public QMap<QString, CfgSet*> {...}
I'm trying to iterate over all its elements like that:
CfgMgr* m_pDefaults = new CfgMgr;
// .../...
QMapIterator<QString, CfgSet*> ics(*m_pDefaults);
while (ics.hasNext()) {
// doing my stuff
}
And I get the compile error:
...
I'm having problems proxying metods with parameters using Castle DynamicProxy v1.1.5.0. - I get the exception "Index was outside the bounds of the array."
If I only use methods with no parameters, OR DynamicProxy v2, everything works ok.
Unfortunately, I'm having trouble convincing the leads on my project to add a dependency to v2 (we'...
I am creating a custom MaskedTextBox for Date only. Now i want to hide Mask property of MaskedTextBox from its users.
EDIT:
public class CustomDateMask:System.Windows.Forms.MaskedTextBox
{
public new string Mask
{
get;
private set;
}
public CustomDateMask()
{
...
I have an abstract superclass that has JPA annotations on it mapping some of its fields. The class itself has the @MappedSuperclass annotation.
Can I specialize/add or change just one element of an inherited annotation without re-specifying the entire annotation?
...
Curious situation:
public class MyTextBox : TextBox
{
// I want use the same height for all MyTextBoxes
public new static int Height;
}
public Form1()
{
InitializeComponent();
MyTextBox mtb1 = new MyTextBox();
MyTextBox mtb2 = new MyTextBox();
mtb1.Multiline = true;
m...
I want to keep a dictionary of (all, non-immediate included) subclasses in a base class, so that I can instantiate them from a string. I'm doing this because the CLSID is sent through a web form, so I want to restrict the choices to the ones set from the subclasses. (I don't want to eval()/globals() the classname).
class BaseClass(obje...
I've a custom container which is implemented in two different ways, but with a single interface. some thing like this.
class Vector
{
virtual Iterator begin() = 0;
virtual Iterator end () = 0 ;
... // some more functions.
} ;
class VectorImplA : public Vector
{
Iterator begin() { return m_...
Is it possible to employ some kind of prototypal inheritance in PHP like it is implemented in JavaScript?
This question came to my mind just out of curiosity, not that I have to implement such thing and go against classical inheritance. It just feels like a interesting area to explore.
Are there prebuild functions to combine classical ...
I have a class CommonTableModel that has several instance methods and each operate on the two instance variables
columnNames
data
Now, I have six tables, each has diff. column names but should have all the instance methods of the CommonTableModel class. So to pass an instance of the CommonTableModel to a JTable instance, I should fir...
I have a number of abstract superclasses from which my concrete class inherit various methods. Some of these methods need to have JPA or JAXB annotations placed on them in the concrete class. Currently I do this via the following:
@MyLocalAnnotations
@Override
public method inheritedMethodHere (yadda yadda)
{
super.inheritedMethod...
I want to inherit the dependencies of a (parent) pom.xml in a child project i.e. use Project Inheritance. It seems it is necessary to change the default packaging type from 'jar' to 'pom' in this case. But doesn't tell the Maven2 documentation that the packaging type 'pom' is necessary for Project Aggregation i.e. multimodule projects w...