Hi
I have the following problem:
I have a Web Service returning an ArrayList< CommunicationMedia > where CommunicationMedia is a superclass of many other classes and the List contains objects of these inheriting classes - the problem is, that wdsl generated does not contain any other declarations than CommunicationMedia itself - how do...
Here is an easy example:
ASP.NET provides several static classes based around the membership provider. We are forever using them in our pages. We also have a need to extend the base System.Web.UI.Page class. So, one thought we had was to expose the various static classes in our OurCompany.Web.UI.Page implementation.
We cannot use a ...
I have a base Color class that looks something like this. The class is designed to be immutable, so as a result has final modifiers and no setters:
public class Color
{
public static Color BLACK = new Color(0, 0, 0);
public static Color RED = new Color(255, 0, 0);
//...
public static Color WHITE = new Color(255, 255, 255...
Hi!
I'm new to generic class programming so maybe my question is silly - sorry for that. I'd like to know whether the following thing is possible and - if so, how to do it
I have a simple generic class Provider, which provides values of the generic type:
template <class A_Type> class Provider{
public:
A_Type getValue();
void setSu...
Suppose I have some code like this:
class Base {
public:
virtual int Foo(int) = 0;
};
class Derived : public Base {
public:
int Foo(int);
virtual double Foo(double) = 0;
};
class Concrete : public Derived {
public:
double Foo(double);
};
If I have a object of type Concrete, why can I not...
I've not used C++ in a while, and I've become far too comfortable with the ease-of-use of real languages.
At any rate, I'm attempting to implement the Command pattern, and I need to map a number of command object implementations to string keys. I have an STL map of string to Command, and I'd like to copy the Command.
Essentially,
Com...
Hi I have two classes, one called Instruction, one called LDI which inherits from instruction class.
class Instruction{
protected:
string name;
int value;
public:
Instruction(string _name, int _value){ //constructor
name = _name;
value = _value;
}
~Instruction(){}
Instruction (const Instruction &r...
class A {
public void talk(){
this.sayIt();
}
private void sayIt(){
System.out.println("class A says...");
}
}
class B extends A {
private void sayIt(){
System.out.println("class B says...");
}
}
B b = new B();
b.talk()
//output
class A says...
I cannot get this since:
Class B inherits from class A the public member and ...
Hi
A couple of friends was discussing the use of inheritance and how to check if a subclass is of a specific type and we decided to post it here on Stack. The debate was about if you should implement a abstract enum in the base class to be used for checking the type of the subclass, or if you should use the is operator.
Alt 1.
public ...
I want to be able to define
template <class TX>
void f(const TX &x){ ... }
template <class TY>
void f(const TY &x){ ... }
where TX must be derived from BaseX and TY must be derived from BaseY (how do I specify this kind of thing?), and I want to be able to call it as
f(DerivedX<T>())
It is most important that I can avoid specifying...
I have a couple of small classes to represent parts in a search filter. If the searched value equals NonValue the filter is supposed to do nothing. This is defined in a Base Class:
Private Class BaseFilter
Protected NonValue As Object
Protected sQueryStringBase As String = "AND {0} {1} {2} "
Public Sub Check...
Hi,
I'm using the DockPanel Suite in my winforms app. The DockContent class is derived from System.Windows.Forms.Form class and my two forms, dockRounds and dockToolbox, inherit from the DockContent class.
This is the first time I've done this and this is probably a stupid question, but in runtime, how do I access the controls of the d...
I am writing a logging service for one of my applications but I am sure many other applications would use this. In that case, would it make sense to make the application extend a class and have all my logging enabled by default (because some logging like application entry point and exit point are required at any cost) in the original cla...
Hi,
I have a custom user control. Normally it inherites the UserControl class. But by this way it inherites all the public methods and properties of UserControl. But I want to hide all these and implement my own few methods and properties.
Say that I have a custom control named CustomControl.
public class CustomControl : UserControl
...
Effective Java, along with other sources suggest that we should consider using composition over inheritance. I have often found my self achieving such composition by using the Decorator pattern and implementing forwarding methods that delegate invocations to a wrapped object.
However, I often find myself writing many simple forwarding ...
Scenario: I have the following defined classes.
class Baseclass { };
class DerivedTypeA : public Baseclass { };
class DerivedTypeB : public Baseclass { };
// ... and so on ...
class Container
{
list<Baseclass*> stuff;
list<DerivedTypeA*> specific_stuff;
// ... initializing constructors and so on ...
public:
void add(Basecla...
Possible Duplicate:
Whats the right way to overload operator== for a class hierarchy?
In C++, how can derived classes override the base class equality test in a meaningful way?
For example, say I have a base class A. Classes B and C derive from A. Now given two pointers to two A objects, can I test if they are equal (including ...
I'm having trouble deciding on a way to model this type of relationship...
All bosses can do certain things and have certain things (velocities, health, etc.) so these are part of the "main" abstract boss class.
class Boss // An abstract base class
{
//Stuff that all Bosses can do/have and pure virtual functions
};
Now I want to ...
so with this class i have
public class Options
{
public bool show { get; set; }
public int lineWidth { get; set; }
public bool fill { get; set; }
public Color fillColour { get; set; }
public string options { get; set; }
public virtual void createOptions()
{
options...
I have this code.
A base class that create a new instance of the context.
public class Base
{
private Entities context;
public Base()
{
context = new Entities();
}
}
And than the classes that inherit from this class.
public class SomeService : Base
{
public Gallery Get(int id)
{
...