derived

C++ Derived Class problems

I am making a game in C++ and am having problems with my derived class. I have a base class called GameScreen which has a vitrual void draw() function with no statements. I also have a derived class called MenuScreen which also has a virtual void draw() function and a derived class from MenuScreen called TestMenu which also has a void ...

C# - Can publicly inherited methods be hidden (e.g. made private to derived class)

Suppose I have BaseClass with public methods A and B, and I create DerivedClass through inheritance. e.g. public DerivedClass : BaseClass {} Now I want to develop a method C in DerivedClass that uses A and B. Is there a way I can override methods A and B to be private in DerivedClass so that only method C is exposed to someone who w...

Deriving COM interfaces in .NET

This is complicated, at least for me, so please bare with me. I'll also preface with I've spent a day searching, to no avail. Due to company constraints out of my control, I have the following scenario: A COM library that defines the following interface (no CoClass, just the interface): [ object, uuid(xxxxxxxx-xxxx-xxxx-xxxx-...

C++ Abstract class - constructor issues

Socket has a constructor that takes a winsock SOCKET as parameter and stores it in a private variable: Socket::Socket(SOCKET s) { this->s = s; } I'm trying to make an abstract class "GameSocket" that will parse data from my Socket class: class GameSocket : public Socket { protected: void ParseData(unsigned char* data, int s...

Creating software derivative works from open source

This question has always been around my head. Can someone create a new product based on an existing open source project? Say you want to create an "Apaxe webserver" that is basically Apache with your some extra plugins ( say support for ASP or something similar ) Is this possible? Would you be able to create a closed source product...

Fortran 90, Questions about Array & Derived Type

I have questions about Arrays and Derived Types. For my new project, I have to use an array instead of a scratch file to store information from users. To do this, I need to create derived types, too. However, I haven't understood what an array is and what a derived type is, how to use them, what they can do, and some other basic ideas. ...

How to access a data class's private member variable from another derived class whose parent class is a friend class of the data class?

I have three classes: A data holder class CDataHolder, which uses a Pimpl pattern class CDataHolder { public: // ... private: friend class CBase; struct PImpl; PImpl* iPimpl; }; A base class CBase, which need to access the iPImpl member in CDataHolder, so it is a friend class of CDataHolder class CBase: { protected: CDataHolde...

Is it possible to derive functions from functions?

I'm wondering if it is possible to derive functions from functions, similar to how classes can be derived from other classes? And if C++ does not explicitly allow this, is there a way to somehow indirectly derive functions from functions? ...

Entity Framework - Association From Derived Entities

Hi, I'm using the TPH (Table per Hierarchy) technique to map a set of entities. DB Schema: UserGroupLabelSpreads table having a "UserId", "GroupId" and "LabelId" nullable fields with some additional common fields. DAL Objects: - UserGroupLabelSpread abstract class. - UserSpread with a discriminator having only non-null UserId. - GroupS...

Why doesn't a derived template class have access to a base template class

Consider: template <typename T> class Base { public: static const bool ZEROFILL = true; static const bool NO_ZEROFILL = false; } template <typename T> class Derived : public Base<T> { public: Derived( bool initZero = NO_ZEROFILL ); // NO_ZEROFILL is not visible ~Derived(); } I can't compile...

Is it possible to have a base class with a return type that adjusts to the type of the base class?

Basically my setting is this: public abstract class BaseObject{ public abstract BaseObject Clone(); } public class DerivedObject : BaseObject{ public DerivedObject Clone() { //Clone logic } } The above code doesn't compile because it isn't possible to change the return type when overriding a method. Is it po...

C++ Vector Pointers to Objects

I'm using a vector of pointers to objects. These objects are derived from a base class, and are being dynamically allocated and stored. For example, I have something like: vector<Enemy*> Enemies; and I'll be deriving from the Enemy class and then dynamically allocating memory for the derived class, like this: enemies.push_back(new M...

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...

Use of "Public" in a derived class declaration?

Given this base class: class Employee { char* name; int age; public: Employee(char* name); void print(); }; With regards to the "public", what's the difference between this: class Manager : public Employee { EmployeeList employees; public: Manager(char* name, Employee* people); void print(); }...

Generic function on a list of derived class

Hi; I feel my question is pretty dumb, or another way to put it is : I'm too lost in my code to see a workaround for now. Stay too long on a problem, and your vision becomes narrower and narrower ><. Plus I'm not good enough with inheritance, polymorphism and so Here is the idea : I have multiple list of derived class, and I would like...

m2eclipse marking 'target' directory as 'Derived'

I have a Maven Java project, imported using m2eclipse. The target/ directory is not marked as 'Derived' by m2eclipse. Problems: It is validated, so any validation error appear twice. My example shows a JSP Problem, when I insert intentionally an error in a jsp. When I want to open a resource with Ctrl-Shift-R, all files appear twic...

Derived Constructor

In the following code: import java.io.*; public class MyClass1 { MyClass1() { System.out.println("base class"); } public void print() { System.out.println("base print"); } } class ChildClass extends MyClass1 { public ChildClass() { System.out.println("child class"); } ...

Visual C++ 6.0 - OnInitDialog in a Derived CDialog class not working

Hi, I have create a simple MFC appwizard dialog project. I used the Class Wizard to create a new class called CMyDlg based on CDialog. Then I went to the Message Map screen and doubleclicked on the WM_INITDIALOG entry to automatically create a CMyDlg::OnInitDialog() handler. The problem I have is that CMyDlg::OnInitDialog() will not cal...

C#: Inheriting separate static members for derived classes.

My problem in brief: class A { /* Other stuff in my class*/ protected static staticMember; } class B : A { /* Other stuff in my class*/ // Will have A.staticMember but I want B.staticMember (same type) } class C : A { /* Other stuff in my class*/ // Will have A.staticMember but I want C.staticMember (same type) } ...

Can Eclipse be configured to disable warnings for derived source files?

I am using ANTLR to generate Java source files. I can make Eclipse understand the generated files are derived, but it still gives me warnings about harmless things (e.g. unnecessary imports and so on). I would like to configure Eclipse to ignore derived files when showing warnings. Is this possible? ...