abstract-class

help with java type erasure.

Hello good people! in my long journey to learn about hibernate, i wanted to use generic DAO and came across a good article at the hibernate site and tried out the IMPLEMENTATION WITH HIBERNATE Section.I'm having an error saying :GenericDAOImpl.java:[22,16] name clash: makeTransient(T) in GenericDAOImpl and makeTransient(T) in GenericDAO ...

Preferred way to simulate interfaces in C++

Since C++ lacks the interface feature of Java/C#, what is the preferred way to simulate interfaces in C++ classes? My guess would be multiple inheritance of abstract classes. What are the implications in terms of memory overhead/performance? Are there any naming conventions for such simulated interfaces, such as SerializableInterface? ...

Abstract class and Interface class?

Hi, I'm new to Java. Why are abstract or interface classes created, or when should we use abstract or interface classes? ...

How to mutate a private field from the abstract class in Java?

There's an abstract class: public abstract class AbstractAny { private long period; public void doSomething() { // blah blah blah period = someHardcodedValue; // blah blah blah } } I don't want to change the source of the abstract class but need to add some flexibility on how the field period is being set. Is it pos...

When to use interfaces or abstract classes? When to use both?

While certain guidelines state that you should use an interface when you want to define a contract for a class where inheritance is not clear (IDomesticated) and inheritance when the class is an extension of another (Cat : Mammal, Snake : Reptile), there are cases when (in my opinion) these guidelines enter a gray area. For example, say...

Object Orientation - Where to place this Interface Declaration...

Hi there. I have a few questions for you wise people involving OO design with Interfaces and abstract base classes. Consider the following scenario: I have an abstract bass class "DataObjectBase" and a derived class "UserDataObject." I also have an interface "IDataObject." The interface of course exposes all of the public methods an...

c# Generics help - how to pass params to new T()

Possible Duplicate: Create instance of generic type? How can I pass a param to a generic contstructor? public class Payment<T> where T: HostFunctionContext, IClaimPayment, new() { public IResultEntity Display(MyUser user, string claim, int? cert) { **HostFunctionContext func = new T(user) as HostFunctionCon...

Using abstract class as a template type

I'm still pretty new to c++ (coming over from java). I have a stl list of type Actor. When Actor only contained "real" methods there was no problem. I now want to extend this class to several classes, and have a need to change some methods to be abstract, since they don't make sense as concrete anymore. As I expected (from the documenta...

What should the accessablity of Fields in a Abstract Class be?

To put it simply as an example, public abstract class AbstractFellow { protected Thing buddy; .... public class ConcreteFellow extends AbstractFellow { public void someMethod() { buddy.doSomething(); //OR buddy = somethingElse; //OR somethingElse = buddy; } } Is this ba...

C++/CLI workaround for implementing a C++ interface

Micropather requires users implement their abstract class "Graph" in order to use the library. What's a good way to do this from C++/CLI so I can use Micropather in .NET? There are only two methods to implement: virtual float LeastCostEstimate( void* stateStart, void* stateEnd ) = 0; virtual void AdjacentCost( void* state, std::vector<...

Abstract class - Java basics

Can an abstract class have a final method in Java? ...

Unresolved External (abstract class constructor/destructor)

So, I have an abstract class Panel and an implementation of it MyPanel. They look similar to this: class Panel : public QWidget { public: Panel(QWidget* parent = 0) = 0; virtual ~Panel() = 0; // but wait, there's more!! }; class MyPanel : public Panel { public: MyPanel(QWidget* parent = 0); ~MyPanel() {}; // nothing to do her...

Using a Windows Form as an abstract class - which pattern to use?

I'm struggling with a situation that I come up again time and time again but I am not sure whether the way that I am doing things is wrong or whether I could be doing things in a different way. An Example: I have a Windows Form that has a DataGridView with some private methods to perform validation of the datagrid and interpreting righ...

Abstract class in Java

What is an "abstract class" in Java? ...

How to Implement a Base Class with a Method and yet force the Derived Class to Override it?

Having something like this this : public abstract class AAA { protected abstract virtual string ToString() // Error { // Base Stuff } } public abstract class BBB : AAA { public override string ToString() { // Use base.ToString(); // More Stuff } } I read another post (http://stackoverflow.com/questions/6133...

Public class with internal abstract member

We use DevExpress and with today release came a weird change to one of their printing class. The class is named ClosedShapeBase and it is used to print out shape in a report. The class itself is public, but some of its properties are protected internal abstract, like public abstract class ClosedShapeBase : ShapeBase { protected in...

Java abstract modifier

Can the abstract modifier appear before a class, a method or a variable? ...

Should we need to differentiate between Interface class and abstract class, in terms of naming convention?

Hi, Is that important to differentiate between Abstract class and interface class? Abstract class is merely an interface class, with some concrete methods. If the abstract class shares the same prefix "I" with Interface class, we can easily upgrade our interface class to abstract class, by introducing new logic etc. UPDATE The reaso...

Abstract class > mandatory constructor for child classes

Hi, How can I write one abstract class that tells that is mandatory for the child class to have one constructor? Something like this: public abstract class FatherClass { public **<ChildConstructor>**(string val1, string val2) { } // Someother code.... } public class ChildClass1: FatherClass { public ChildClass1...

What is the best way to store and instantiate list of classes in C++ without using STL?

I have a code similar to the following: class News { public: virtual void get() = 0; } class Cnn : News { void get () {...} } class Msnbc : News { void get () {...} } class Bbc : News { void get () {...} } main () { News * news = new Cnn; news->get () News * news = new Msnbc; news->get () News * news = new Bbc; news...