abstract

What's the difference between virtual function instantiations in C++?

What's the difference between the following two declarations? virtual void calculateBase() = 0; virtual void calculateBase(); I read the first one (=0) is a "pure abstract function" but what does that make the second one? ...

In C++, how can I implement this OOP concept?

I have two implemented classes: class DCCmd : public DCMessage class DCReply : public DCMessage Both are protocol messages that are sent and received both ways. Now in the protocol implementation I'd need to make a message queue, but with DCMessage being abstract it won't let me do something like this: class DCMsgQueue{ pri...

should I name all my abstract classes AbstractFoo

Is it good practice to make sure that all abstract classes have names prefixed with "Abstract"? ...

How can I get polymorphic behavior in a C++ constructor?

I have a base class that I want to look like this: class B { // should look like: int I() { return someConst; } virtual int I() = 0; public B() { something(I()); } } The point being to force deriving classes to override I and force it to be called when each object is constructed. This gets used to do some bookkeeping and I...

Generics question

I have a generic class public class Decoder<SIGNAL> where SIGNAL : signalType, new() signalType is a abstract class. How do I declare a dynamic field to store it? The following code will throw a compile error saying that Decoder must be a non abstract type generic. public class DecoderParent { private Decoder<signalType> decode...

Override abstract readonly property to read/write property.

I would like to only force the implementation of a C# getter on a given property from a base abstract class. Derived classes might, if they want, also provide a setter for that property for public use of the statically bound type. Given the following abstract class: public abstract class Base { public abstract int Property { get; }...

A pointer to abstract template base class?

Dears, I cannot figure this out. I need to have an abstract template base class, which is the following: template <class T> class Dendrite { public: Dendrite() { } virtual ~Dendrite() { } virtual void Get(std::vect...

groovy mocks with abstract methods

I have a Java object called Parameter and I'm trying to mock it using groovy. Parameter is an abstract class with 1 abstract method. It also has a non-abstract method called getName(). I'm trying to mock it as follows in Groovy: def p1 = [name:{"p1Name"}] as Parameter But I get a runtime error because I don't implement the abstract m...

Best operating system abstraction?

I'm looking for something to abstract the standard operating system functionality in C/C++: span/kill a thread, send/receive a message, start/stop a timer, maybe even memory management, although I can probably handle that myself with my own buffer pool. I want to to be able to develop and unit test on Linux/windows and then recompile th...

C++ - "Member function not declared" in derived class

I have a problem in MSVC++ 2008 where VS2008 is throwing this compile error: error C2509: 'render' : member function not declared in 'PlayerSpriteKasua' Now, what's confusing me is that render() is defined, but in an inherited class. The class definition works like this: SpriteBase -Inherited By-> PlayerSpriteBase -Inherited By-> Pl...

Is it possible to execute a "C" statement without a semicolon

Post an example to execute a "C" statement without semicolon( ; ) ...

WCF DataContract with an abstract DataMember array

I can't make this scenario work. Here's the pattern- [DataContract] /*abstract*/ class BaseT { ... } [DataContract] class ChildT : BaseT { ... } [DataContract] class MessageContents { [DataMember] public BaseT[] XX; // Array of BaseT objects. I need WCF to somehow figure out that they're actually ChildT. } // ...receive a web...

An abstract method overrides an abstract method

public abstract class A { public abstract void Process(); } public abstract class B : A { public abstract override void Process(); } public class C : B { public override void Process() { Console.WriteLine("abc"); } } This code throws an Compilation Error: 'B' does not implement inherited abstract member 'A...

what does abstract mean in this context?

I'm completley new to python, so I'm having a hard time getting started with some code we got as a framework for a homework assignment. I'll stress that I don't want help with doing the actual homework, only some help in understanding some python concepts. here is the code snippet: class TilePuzzleProblem(search.Problem): """ This cla...

[C++] Using a virtually inherited function non-virtually?

Hello! I have run into trouble trying to implement functionality for serializing some classes in my game. I store some data in a raw text file and I want to be able to save and load to/from it. The details of this, however, are irrelevant. The problem is that I am trying to make each object that is interesting for the save file to be ab...

Abstract base classes and appdomains

I apologize now if my upcoming explanation doesn't make enough sense; I'm reknown for it, though I try to do otherwise. I'm writing a service that makes use of user-defined plugins. I'm trying to isolate them -- keeping their assemblies out of the service's appdomain -- by making use of interfaces defined in a shared assembly. What's ...

Java: Abstract class constructors and this()

I feel like I'm missing something here; can someone point out what I'm misunderstanding?! I've got two classes, an Abstract and a Concrete, as follows: public abstract class Abstract { protected static int ORDER = 1; public static void main (String[] args) { Concrete c = new Concrete("Hello"); } public Abs...

Does an abstract property create a private backing field?

Simple question: does an abstract property create a private backing field? Example: public abstract Name { get; set; } Will this create a private backing field? I want to force any class that derives this property to use their own backing field, not one that's created by the compiler. ...

How can I force inheriting classes to implement a static method in C#?

All I want to do is make sure that child classes of the class Item implement a static method and I want this to be checked at compile time to avoid runtime errors. abstract classes with static methods don't seem to work: ERROR: A static member cannot be marked as override, virtual, or abstract public abstract class Item { ...

Why do I get an "abstract error" when calling TJclCompressArchive.Compress?

I have the following code that always fails with an "Abstract Error": arch := TJclCompressArchive.Create(GetDesktop + 'Support.7z'); try with arch do begin if FindFirst('*.log', faAnyFile, sr) = 0 then begin repeat AddFile(ExtractFileName(sr.Name),sr.Name); until FindNext(sr) <> 0; ...