|
|
Quote: when they're going to come back at home Your parents ran away?
- I would love to change the world, but they won’t give me the source code.
|
|
|
|
|
Michael Martin wrote: It's been over six years since I have logged in full stop Not full stop for me... But I usually only go once a year or every 18 months to delete crap and check the settings and make them the most restrictive I can find.
But being honest... it was actually helpful a couple of years ago to reestablish contact with old buddies that had changed their email addresses / phone numbers.
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
I deleted my account. About 8 years ago, I had created an account and after 1 month I had 2 friends, both ex-girlfriends. The ironic thing was my long-term girlfriend at the time would not friend me!
|
|
|
|
|
Jeremy Falcon
|
|
|
|
|
I just wrote this in a piece of code I'm overhauling:
protected abstract override void ......();
An abstract class (inheriting from another abstract class) which is going to be implemented by a bunch of concrete classes which will all also be implementing two other interfaces at the same time.
What unholy mess are you getting yourself into Dave?
|
|
|
|
|
There are stranger things under the coding heavens, Dave!
Get me coffee and no one gets hurt!
|
|
|
|
|
Yeah, but it feels ... wrong. A class structure that can't make up its mind how it's going to do the job.
I really can't complain. I'm the one designing the solution. Sometimes I know not why my brain comes up with this stuff.
|
|
|
|
|
know not the unknowns, that's a legal option ...
|
|
|
|
|
Dave Kreskowiak wrote: Yeah, but it feels ... wrong I somehow was expecting that ending in other way
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
|
Software Zen: delete this;
|
|
|
|
|
Dave Kreskowiak wrote: System.ItDidntWorkException: Something didn't work as expected.
Should that be "Something didn't work, as expected"?
|
|
|
|
|
Its actually a jab at all the questions where the entire problem description is "it didn't work".
|
|
|
|
|
May I suggest you...
The Weird and The Wonderful[^]
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
It's a protected, abstract function which overrides an inherited abstract function that returns void. If anything is strange it's that you have a need for it to begin with. Why override an inherited abstract function with another abstract function? In the inheritance hierarchy in C# ancestral abstract functions still need to be defined by concrete classes.
|
|
|
|
|
Now that's a good question - my thought as well. Why is this needed at all?
Regards,
Rob Philpott.
|
|
|
|
|
Are you sure it's not a protected abstract function that overrides an inherited virtual function?
abstract class A
{
protected virtual void Foo() => Console.WriteLine("A.Foo");
}
abstract class B : A
{
protected abstract override void Foo();
}
class C : B
{
protected override void Foo()
{
Console.WriteLine("C.Foo");
}
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I had not considered that possibility.
|
|
|
|
|
The base abstract has a base implementation that sets up a default environment for processing a data "packet". The higher level abstract is actually three abstract classes, each covering a certain "class" of data, that each implement their own version of this method to further setup the environment that the concrete classes are going to use to process their "class" of "packets".
By the time you get to the concrete classes, they should already have everything they need to start processing its little version of a "packet" and finishing off the implementations of the two abstract classes. Each of the ~60 packet types fit into 3 different "classes".
Basically:
Overall Abstract Class Framework for processing a "packet"
/ | \
/ | \
Type 1 Abstract Type 2 Abstract Type 3 Abstract Additional framework for each packet "Class"
\ | /
\ | /
~60 Concrete Classes Supplies processing implementation for each packet
It feels wrong but it's working out perfectly so far.
I wish I could post some code samples and details but security prevents it.
|
|
|
|
|
Interesting. Seems like a good solution for your problem as described. What I was curious about though is the need for the override in the first place. For example the function X in the following doesn't need to be re-abstracted in class B.
abstract class A
{
public abstract void X();
public virtual void R() { return; }
}
abstract class B : A
{
public abstract override void R();
}
class C : B
{
public override void X() { return; }
public override void R() { return; }
}
Richard brought up a good point though in that it could be virtual function hiding like the function R above. I can't really think of why that would be useful though in this case.
|
|
|
|
|
The one question I haven't seen anyone else ask in this thread: does it do what you wanted it to do?
|
|
|
|
|
|
I had a similar thing happen a few weeks ago.
I was working on some sticky logic, and I created a true "goto" in my Java code using while(true) and labeled breaks.
It worked fine, but it was just SO WRONG that I introduced a new function to eliminate it.
Executing a "return" from the middle of a function is a lot more palatable to my brain.
First time in 20+ years of using Java that I ever came up with that particular construct, hopefully I won't do it again (in any language) for another 20 years.
For your particular case, it almost sounds like the super class constructor should require a parameter which represents the required "service." Sub classes will be forced to provide an implementation of the service to the parent appropriate to the subclasses requirements.
|
|
|
|
|