Click here to Skip to main content
15,912,507 members
Home / Discussions / C#
   

C#

 
GeneralRe: how to deploy your software (set up) Pin
Richard MacCutchan17-Apr-18 6:41
mveRichard MacCutchan17-Apr-18 6:41 
GeneralRe: how to deploy your software (set up) Pin
ago248617-Apr-18 6:52
ago248617-Apr-18 6:52 
GeneralRe: how to deploy your software (set up) Pin
Richard MacCutchan17-Apr-18 8:45
mveRichard MacCutchan17-Apr-18 8:45 
GeneralRe: how to deploy your software (set up) Pin
ago248617-Apr-18 22:35
ago248617-Apr-18 22:35 
GeneralRe: how to deploy your software (set up) Pin
Richard MacCutchan17-Apr-18 22:38
mveRichard MacCutchan17-Apr-18 22:38 
GeneralRe: how to deploy your software (set up) Pin
ago248617-Apr-18 22:57
ago248617-Apr-18 22:57 
GeneralRe: how to deploy your software (set up) Pin
ago248617-Apr-18 23:48
ago248617-Apr-18 23:48 
GeneralRe: how to deploy your software (set up) Pin
Richard MacCutchan17-Apr-18 23:56
mveRichard MacCutchan17-Apr-18 23:56 
GeneralRe: how to deploy your software (set up) Pin
ago248618-Apr-18 0:00
ago248618-Apr-18 0:00 
GeneralRe: how to deploy your software (set up) Pin
ago248618-Apr-18 0:01
ago248618-Apr-18 0:01 
GeneralRe: how to deploy your software (set up) Pin
Richard MacCutchan18-Apr-18 0:13
mveRichard MacCutchan18-Apr-18 0:13 
GeneralRe: how to deploy your software (set up) Pin
ago248618-Apr-18 0:16
ago248618-Apr-18 0:16 
AnswerRe: how to deploy your software (set up) Pin
Gerry Schmitz18-Apr-18 6:24
mveGerry Schmitz18-Apr-18 6:24 
GeneralRe: how to deploy your software (set up) Pin
ago248618-Apr-18 6:52
ago248618-Apr-18 6:52 
GeneralRe: how to deploy your software (set up) Pin
Gerry Schmitz18-Apr-18 9:07
mveGerry Schmitz18-Apr-18 9:07 
GeneralRe: how to deploy your software (set up) Pin
ago248619-Apr-18 21:48
ago248619-Apr-18 21:48 
GeneralRe: how to deploy your software (set up) Pin
Gerry Schmitz20-Apr-18 6:22
mveGerry Schmitz20-Apr-18 6:22 
GeneralRe: how to deploy your software (set up) Pin
ago248620-Apr-18 6:30
ago248620-Apr-18 6:30 
Questionconsolidating four similar classes Pin
Alexander Kindel16-Apr-18 15:23
Alexander Kindel16-Apr-18 15:23 
AnswerRe: consolidating four similar classes Pin
#realJSOP17-Apr-18 2:24
professional#realJSOP17-Apr-18 2:24 
GeneralRe: consolidating four similar classes Pin
Alexander Kindel17-Apr-18 11:34
Alexander Kindel17-Apr-18 11:34 
GeneralRe: consolidating four similar classes Pin
#realJSOP17-Apr-18 12:33
professional#realJSOP17-Apr-18 12:33 
GeneralRe: consolidating four similar classes Pin
Alexander Kindel17-Apr-18 16:53
Alexander Kindel17-Apr-18 16:53 
Are you thinking of a setup something like this (I would probably create a ModdedInteger class and use that instead of Integers plus a Characteristic field if I could make this approach work)?
C#
abstract class Polynomial<T> where T : IArithmetic<T>...
class IntegerPolynomial : Polynomial<Integer>, IArithmetic<IntegerPolynomial>...
class ModdedPolynomial : Polynomial<ModdedInteger>, IArithmetic<ModdedPolynomial>...
class RationalPolynomial : Polynomial<Rational>, IArithmetic<RationalPolynomial>...
class FieldElement : Polynomial<RationalPolynomial>, IArithmetic<FieldElement>...

The problem I've had with that is, suppose I'm trying to genericize the Integer.GetGCD/FieldElement.GetGCD algorithm to act on Polynomial objects. The only thing I can think to do with the signature is this:
C#
Polynomial<T> GetGCD<T>(Polynomial<T> a, Polynomial<T> b) where T : IArithmetic<T>

But then if I pass IntegerPolynomial objects, I get back a Polynomial<integer>, when what I really want is another IntegerPolynomial. I have the same problem with every other method that returns an object whose type is the same as the class it belongs to. I would have to extract the coefficients from the Polynomial object and use them to construct an object of the derived type I actually wanted almost every time I used any of them. This is why I mentioned considering the possibility of shoving everything into a single generic class - in that case I would be passing Polynomial<integer> objects, and the Polynomial<integer> object I'd get back would be exactly what I'd want.

In case you're inclined to play with it, here's the whole program.
GeneralRe: consolidating four similar classes Pin
#realJSOP19-Apr-18 2:50
professional#realJSOP19-Apr-18 2:50 
AnswerRe: consolidating four similar classes Pin
Gerry Schmitz18-Apr-18 7:05
mveGerry Schmitz18-Apr-18 7:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.