abstract-class

abtract class constructor

In c# we can't create an obeject of a abstact class or interface it means abstract class do not have any constructor, is it true ? or if it have then what is it's purpose there? ...

Interface is forceing abstract class to implement its functions

I have got a abstract class which is implementing 3 interfaces. public abstract class ServiceBaseCore<Entity, EntityKey> : MarshalByRefObject, IComponentService, IEntityProvider<Entity, EntityKey> where Entity : IEntityId<EntityKey>, new() where EntityKey : IEntityKey, new() { // Provided functionality/body to some methods of...

Why is there no "Iterable" interface in the STL?

The C++ STL does not seem to use purely abstract base classes (aka interfaces) very often. I know that most things can be achieved with the STL algorithms or clever template metaprogramming. But still, for some use cases (for example, in an API, if I do not want to be specific about the type of container I get, just about the elements ...

On abstract classes in Java and Hibernate annotations.

I am planing to create an application relying on DB using Hibernate. I will have some similar classes like teacher and student and so on. In DB they will have some fields with similar names. So I wonder If I can create a class Human with annotations for standard fields like Name, SName and so on so to just extend that class in teacher st...

Diffrent models sharing one ID list

In my application I've added "Facebook Comment Box" on different pages for different objects. Each object has it's own comments list so I need to provide a unique (across the site) xid for every single one of them. So what would be the best approach for achieving this ? Some abstract model that all other models will inherit ? Dummy model...

Using many classes in GUI that inherit from a base

Hi all, I have classes setup similar to this: <DataContract()> _ Public MustInherit Class SystemTaskProcessBase Public MustOverride ReadOnly Property Name() As String Public MustOverride ReadOnly Property Description() As String Public MustOverride Property Result() As SystemTaskResult <DataMember()> _ Private _T...

Can multiple inheritance be achieved in C# using interfaces?

I often encounter in articles which describe abstract class and interface, that C# does not support multiple inheritance but can be achieved using interfaces. I don't agree to that for the following reasons We always inherit the state and behavior from any class. Interface does not define the state or behavior. We cannot inherit anythi...

Alternatives to abstract classes in Ruby?

I am new to Ruby. A simple example, what I need: class Animal abstract eat() class Cat < Animal eat(): implementation class Dog < Animal eat(): implementation In other words, the eat() method should be required for all the classes which extend Animal. In JAVA I would just use an abstract class, but after doing so...

Entity Framework 4 Abstract Model - How to Programatically Eager-Load Navigational Properties?

Hi Guys, I have an EF4 Model that is built with abstract entities/classes: Notice how State entity has a navigational property called Country. Note: I have lazy-loading disabled, so i must eager-load on demand. Now, if i have the following method: public Location FindSingle(int id) { return _repository.Find().WithId(id).SingleO...

ASP.NET MVC 2 - Binding To Abstract Model

Hi Guys, If i have the following strongly-typed view: <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<XXX.DomainModel.Core.Locations.Location>" %> Where Location is an abstract class. And i have the following Controller, which accepts a strongly-typed Model via a POST: [...

Abstract Class Design: Why not define public constructores ?

Hi guys, Look at here (Abstract Class Design): http://msdn.microsoft.com/en-us/library/ms229047.aspx It says: (1) Do not define public or protected internal (Protected Friend in Visual Basic) constructors in abstract types. In C#, we are not able to instantiate an abstract class. So, does it still matter to define public constructors...

ADT - Iterators - operator ++

This isnt a homework question. I took data structures at a Community College and now that i am at the university i talked to the teacher about there data structures class. Now, since its really different and the class i took transferred, He gave me one of there assignments and said play with it. We never did any containers, wrappers,temp...

C# abstract class, works with array initialization.

Hey All, As we know that we CANNOT create the instance of abstract class. I just want to know that if we create the array of abstract class, it will sure work. E.g. public abstract class Creator { public abstract void DoSomething(); } Creator creator = new Creator(); // this will give you compilation error! Creator[] creator = ...

How to create a "class cluster" (factory class with instances of concrete subclasses) in Ruby?

I would like to create an abstract class which will create concrete instances depending on initialization parameter. Example: class SomethingGeneric def self.new(type, arg) class_name = "#{type.capitalize}Something" if obj.const_defined?(class_name) a_class = obj.const_get(class_name) else raise ArgumentErr...

Class design, Interfaces or Concrete classes

Hi all, I have a problem regarding the use of interfaces vs concrete classes. I have a base class that implements some common properties/methods. Now i have two possible extensions. Either this base class can have some property called Parameters, Or it can have another property called Children, or it can have both. The way i see it i c...

How do I test my plug-in interface which uses an abstract class?

I'm using PHP 5.3 and SimpleTest, but more general answers are welcome. Each plug-in will be a class which extends an abstract class... how do I test that this interface works properly? Do I have to create several plug-ins and test them? Or is there a more satisfying way? As an example, imagine writing something to represent money. User...

Django: Accessing child class of an abstract model

I have several user profile models inherited from one base class like this: class BaseProfile(models.Model): user = models.ForeignKey(User) name = models.CharField(max_length=100) ... class Meta: abstract = True class DoctorProfile(BaseProfile): license_no = models.CharField(max_length=10) ... class Pha...

Problem with extending a Class

I'm having a problem extending a class which itself further extends a abstract class. The base abstract class has the following methods: Abstract: private final __construct() abstract protected function loadFromId() private static final load($id) Class 1 extends Abstract: protected loadFromId() Class 2 extends Class 1: //nothing...

Proguard, Android, and abstract class instantiation

"Abstract class instation," you say. "Impossible!" Here's my code: public static AbstractFoo getAbstractFoo(Context context) { try { Class<?> klass = Class .forName("com.bat.baz.FooBar"); Constructor<?> constructor = klass.getDeclaredConstructor( String.class, String.class); c...

Abstract classes - syntax help

I am having a bit of a problem with abstract classes. I have a bunch of classses. In the StackAsLinkedList.h class i have a linked list of pointers to Objects as seen here LinkedList<Object*> list; The syntax is wrong and i dont know what to do. if i name it a int or char i get the same syntax error.. I am fairly new to ADT / class hi...