Questions tagged [derived]
429 questions
8
votes
4 answers
Base class vs Utility class
Which of the two should be preferred?
There are some methods which are called by class A, B and C.
Should those methods be encapsulated in a class D (base of A, B and C) ?
OR
Should those methods be encapsulated in a class U and other classes…

Azodious
- 13,752
- 1
- 36
- 71
8
votes
3 answers
C# - Complete return from base method
I have a virtual base method void Action() that is overridden in a derived class.
The first step in Action is to call base.Action(). If a situation occurs in the base method I do not want the rest of the derived method to be processed.
I want to…

Talib
- 335
- 3
- 15
7
votes
2 answers
How to remove an unused source control master in Xcode?
This is regarding Xcode 9.2. I added a framework (local Git repo) to my project, then deleted it when it did not do what I needed it to do. Now when I do a commit there is a popup with the old GIT master listed there, even though there are no…

ByteSlinger
- 1,439
- 1
- 17
- 28
7
votes
4 answers
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…

KLE
- 23,689
- 4
- 56
- 62
7
votes
3 answers
Code executes derived class method, but gets default parameter from base class method
Can someone explain why the result of the code below would be "class B::1" ?
Why does the virtual method of derived class uses the default parameter of a base class and not his own? For me this is pretty strange. Thanks in advance!
Code:
#include…

Aremyst
- 1,480
- 2
- 19
- 33
6
votes
3 answers
boost serialization of derived object doesn't call derived's serialize()
I've read through loads of similar questions but haven't found the answer. I'm using Visual Studio 2010 and boost 1.47.
Here's the code, it's complete and compilable:
#include "stdafx.h"
#include
#include
#include…

CodeOrElse
- 328
- 2
- 16
6
votes
4 answers
Best way for derived classes to carry different data types in C++
What is the most elegant way to provide an interface in C++ that accepts derived class types that carry with them different data type members that then need to be retrieved later. The example below illustrates this where the Container class…

innocent_bystander
- 389
- 2
- 9
6
votes
1 answer
Circe deriveDecoder/deriveEncoder could not find Lazy implicit value of type io.circe.generic.encoding.DerivedAsObjectEncoder
I am trying to generate encoders and decoders for two case classes:
object EventBusCases {
case class ValuationRequest(function: RequestValue = ALL_DAY_VALS, interval: RequestValue = IntraDayIntervals.MIN_5)
implicit val requestDecoder:…

LeYAUable
- 1,613
- 2
- 15
- 30
6
votes
1 answer
Automapper and class hierarchy
Given the following sources:
public class SourceBase { public string TheString { get; set; } }
public class SourceDerived : SourceBase { }
and destinations:
public class DestBase { public string MyString { get; set; } }
public class DestDerived :…

Andy
- 8,432
- 6
- 38
- 76
6
votes
8 answers
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…

OscarRyz
- 196,001
- 113
- 385
- 569
6
votes
2 answers
forward declaring with inheritance information
This compiles fine, although I wouldn't want to try running it just yet. However ...
//class base;
//class derived;
//class derived : public base;
class base {};
class derived : public base {};
class other
{
public:
void func() {base1…

alan2here
- 3,223
- 6
- 37
- 62
6
votes
6 answers
C# How can I return my base class in a webservice
I have a class Car and a derived SportsCar: Car
Something like this:
public class Car
{
public int TopSpeed{ get; set; }
}
public class SportsCar : Car
{
public string GirlFriend { get; set; }
}
I have a webservice with methods…

HenriM
- 151
- 2
- 4
6
votes
2 answers
derived class as default argument g++
Please take a look at this code:
template
class A
{
class base
{
};
class derived : public A::base
{
};
public:
int f(typename A::base& arg = typename A::derived())
{
return 0;
}
};
int main()
{
A a;
a.f();
…

Vincent
- 1,027
- 1
- 11
- 20
6
votes
4 answers
C++ templates and derived classes
I am trying to understand the following code. Derived is a derived structure from T and what does "," means and then Fallback {}
template
struct has_FlowTraits
{
struct Fallback { bool flow; };
struct Derived : T, Fallback {…

SunilS
- 2,030
- 5
- 34
- 62
6
votes
2 answers
effect of both base and derived virtual destructors
I've had some second thoughts on multiple virtual destructors, esp. after reading reading http://blogs.msdn.com/b/oldnewthing/archive/2004/05/07/127826.aspx .
Suppose I have
class Base
{
public:
Base();
virtual ~Base();
…

icy
- 914
- 6
- 12