1
Answer

Using a delegate in a subclass to override the virtual method in the superclass

Administrator

Administrator

22y
1.8k
1
When using a delegate method in SubClass, the method works as it should. The same if I cast SC to SubClass. However I wish that the delegate method in SubClass should override the method in SuperClass. Unfortunately, override is not a valid keyword when creating delegate methods and the delegate does not have any methods on it's own to designate it an override property. public class MainClass { public SuperClass SC; public MainClass() { SC = new SubClass(); SC.rotateCW(); // MessageBox with "CW/CCW called", correct! SC.rotateCCW(); // MessageBox with "CCW" <--- They should point to the same method!!! } public class SuperClass { public SuperClass() {} public virtual void rotateCW() {MessageBox.Show("CW");} public virtual void rotateCCW() {MessageBox.Show("CCW");} } // End superclass public class SubClass : SuperClass { public rotateCCWDelegate rotateCCW; public SubClass() { rotateCCW = new rotateCCWDelegate(this.rotateCW); } public override void rotateCW() { MessageBox.Show("CW/CCW called"); } public delegate void rotateCCWDelegate(); }
Answers (1)
0
Nel
NA 713 955.3k 12y
SELECT NALOG1.GBRV, NALOG1.DATA,
Min(IIf(([NALOG1].[POCKM]>0),[NALOG1.POCKM],Null)) AS pockm,
Max([NALOG1.KRAJKM]) AS krajkm,
Max([NALOG1.KRAJKM])-Min(IIf(([NALOG1].[POCKM]>0),[NALOG1.POCKM],Null)) AS RAZLIKA,
Max(NOVI.DATAP) AS Poslprov,
Max(NOVI.KMP1) AS KMP,
Max(NOVI.DATAS) AS Poslserv,
Max(NOVI.KMS1) AS KMS,
Sum(NALOG1.km) AS SUMKM,
IIf(Sum(NALOG1.km)>=(([NOVI].[KMS1]+[NOVI].[KMS2])-1000) ,
'ZA SERVIS',

(IIf(Sum(NALOG1.KM)>=(([NOVI].[KMP1]+[NOVI].[KMP2])-1000),'PROVERKA',' '))) AS Zabeleska
FROM NALOG1 INNER JOIN NOVI ON NALOG1.GBRV = NOVI.GBR GROUP BY NALOG1.GBRV, NALOG1.DATA, NOVI.KMP1, NOVI.KMP2, NOVI.KMS1, NOVI.KMS2, NOVI.AB HAVING (((NALOG1.GBRV)=[@gbr1])and ((NOVI.AB)=[@ab1] or (NOVI.AB)=[@ab2]) AND ((NALOG1.DATA)>=[@data1] And (NALOG1.DATA)<=[@data2]))

(I don't know what did you mean by XXXX) and the result was the same. So I don't get one row for a single date, but several.
0
Kunal Vaishya
NA 4.1k 266.1k 12y
try This



SELECT NALOG1.GBRV, NALOG1.DATA,
Min(IIf(([NALOG1].[POCKM]>0),[NALOG1.POCKM],Null)) AS pockm,
Max([NALOG1.KRAJKM]) AS krajkm,
Max([NALOG1.KRAJKM])-Min(IIf(([NALOG1].[POCKM]>0),[NALOG1.POCKM],Null)) AS RAZLIKA,
Max(NOVI.DATAP) AS Poslprov,
Max(NOVI.KMP1) AS KMP,
Max(NOVI.DATAS) AS Poslserv,
Max(NOVI.KMS1) AS KMS,
Sum(NALOG1.km) AS SUMKM,
IIf(Sum(NALOG1.km)>=(([NOVI].[KMS1]+[NOVI].[KMS2])-1000) AS XXXXX  ,
'ZA SERVIS',
(IIf(Sum(NALOG1.KM)>=(([NOVI].[KMP1]+[NOVI].[KMP2])-1000),'PROVERKA',' '))) AS Zabeleska
FROM NALOG1 INNER JOIN NOVI ON NALOG1.GBRV = NOVI.GBR GROUP BY NALOG1.GBRV, NALOG1.DATA, NOVI.KMP1, NOVI.KMP2, NOVI.KMS1, NOVI.KMS2, NOVI.AB HAVING (((NALOG1.GBRV)=[@gbr1])and ((NOVI.AB)=[@ab1] or (NOVI.AB)=[@ab2]) AND ((NALOG1.DATA)>=[@data1] And (NALOG1.DATA)<=[@data2]))