I have a base abstract class A which contains several abstract functions
I then have an abstract class B (derived from A) which overrides a small
subset of A's abstract functions
Finally I have a fully functional class C (deriving from B). Class C
overrides the (A's) abstract functions not tackled by its ancestor B.
I am complained at by the compiler, that in C, I have not implemented the
inherited abstract members defined by A. But I overrode these functions in
B!
Is this correct and why?
Claire
public abstract class A
{
public abstract void Function1();
public abstract void Function2();
public abstract void Function3();
}
public abstract class B : A
{
public override void Function1()
{
doodar;
}
}
public class C : B
{
public override void Function2()
{
}
public override void Function3()
{
}
// Compiler complains that C has not implemented Function1
} 8 4388
Claire,
You have a typo somewhere in your code, or the problem is somewhere else. I
simply cut and pasted your example code below into a new class file, and
created
A eg = new C();
and it compiled fine. (c# with .Net 1.1)
Daniel.
"Claire" <bl****@blahhhhh.com> wrote in message
news:eM**************@TK2MSFTNGP12.phx.gbl... I have a base abstract class A which contains several abstract functions
I then have an abstract class B (derived from A) which overrides a small subset of A's abstract functions
Finally I have a fully functional class C (deriving from B). Class C overrides the (A's) abstract functions not tackled by its ancestor B.
I am complained at by the compiler, that in C, I have not implemented the inherited abstract members defined by A. But I overrode these functions in B!
Is this correct and why?
Claire
public abstract class A { public abstract void Function1(); public abstract void Function2(); public abstract void Function3(); }
public abstract class B : A { public override void Function1() { doodar; } }
public class C : B { public override void Function2() { } public override void Function3() { } // Compiler complains that C has not implemented Function1 }
Claire,
You have a typo somewhere in your code, or the problem is somewhere else. I
simply cut and pasted your example code below into a new class file, and
created
A eg = new C();
and it compiled fine. (c# with .Net 1.1)
Daniel.
"Claire" <bl****@blahhhhh.com> wrote in message
news:eM**************@TK2MSFTNGP12.phx.gbl... I have a base abstract class A which contains several abstract functions
I then have an abstract class B (derived from A) which overrides a small subset of A's abstract functions
Finally I have a fully functional class C (deriving from B). Class C overrides the (A's) abstract functions not tackled by its ancestor B.
I am complained at by the compiler, that in C, I have not implemented the inherited abstract members defined by A. But I overrode these functions in B!
Is this correct and why?
Claire
public abstract class A { public abstract void Function1(); public abstract void Function2(); public abstract void Function3(); }
public abstract class B : A { public override void Function1() { doodar; } }
public class C : B { public override void Function2() { } public override void Function3() { } // Compiler complains that C has not implemented Function1 }
Claire wrote: I have a base abstract class A which contains several abstract functions I then have an abstract class B (derived from A) which overrides a small subset of A's abstract functions
Finally I have a fully functional class C (deriving from B). Class C overrides the (A's) abstract functions not tackled by its ancestor B.
I am complained at by the compiler, that in C, I have not implemented the inherited abstract members defined by A. But I overrode these functions in B!
Is this correct and why?
Claire
public abstract class A { public abstract void Function1(); public abstract void Function2(); public abstract void Function3(); }
public abstract class B : A { public override void Function1() { doodar; } }
public class C : B { public override void Function2() { } public override void Function3() { } // Compiler complains that C has not implemented Function1 }
It should compile. And it actually does for me (.NET 1.1, VS .NET 2003).
Cheers,
--
Joerg Jooss jo*********@gmx.net
Claire wrote: I have a base abstract class A which contains several abstract functions I then have an abstract class B (derived from A) which overrides a small subset of A's abstract functions
Finally I have a fully functional class C (deriving from B). Class C overrides the (A's) abstract functions not tackled by its ancestor B.
I am complained at by the compiler, that in C, I have not implemented the inherited abstract members defined by A. But I overrode these functions in B!
Is this correct and why?
Claire
public abstract class A { public abstract void Function1(); public abstract void Function2(); public abstract void Function3(); }
public abstract class B : A { public override void Function1() { doodar; } }
public class C : B { public override void Function2() { } public override void Function3() { } // Compiler complains that C has not implemented Function1 }
It should compile. And it actually does for me (.NET 1.1, VS .NET 2003).
Cheers,
--
Joerg Jooss jo*********@gmx.net
Claire wrote: I have a base abstract class A which contains several abstract functions
I then have an abstract class B (derived from A) which overrides a small subset of A's abstract functions
Finally I have a fully functional class C (deriving from B). Class C overrides the (A's) abstract functions not tackled by its ancestor B.
I am complained at by the compiler, that in C, I have not implemented the inherited abstract members defined by A. But I overrode these functions in B!
Is this correct and why?
Claire
public abstract class A { public abstract void Function1(); public abstract void Function2(); public abstract void Function3(); }
public abstract class B : A { public override void Function1() { doodar; } }
public class C : B { public override void Function2() { } public override void Function3() { } // Compiler complains that C has not implemented Function1 }
Verify that you have everything correct. The code you have above
compiles fine (after commeting out doodar as that doesn't exist) as it
should. But this appears to be just sample code, not the real stuff.
Is the error about not implementing Function1 in C the only error you
are getting?
--
Tom Porterfield
Claire wrote: I have a base abstract class A which contains several abstract functions
I then have an abstract class B (derived from A) which overrides a small subset of A's abstract functions
Finally I have a fully functional class C (deriving from B). Class C overrides the (A's) abstract functions not tackled by its ancestor B.
I am complained at by the compiler, that in C, I have not implemented the inherited abstract members defined by A. But I overrode these functions in B!
Is this correct and why?
Claire
public abstract class A { public abstract void Function1(); public abstract void Function2(); public abstract void Function3(); }
public abstract class B : A { public override void Function1() { doodar; } }
public class C : B { public override void Function2() { } public override void Function3() { } // Compiler complains that C has not implemented Function1 }
Verify that you have everything correct. The code you have above
compiles fine (after commeting out doodar as that doesn't exist) as it
should. But this appears to be just sample code, not the real stuff.
Is the error about not implementing Function1 in C the only error you
are getting?
--
Tom Porterfield
did you miss out the override keyword on one of the method implementations
in B in the real code.
In that case the C# compiler would assume that the new method is unrelated
to the abstract one (as it didn't deliberately use the override keyword)
Regards
Richard Blewett - DevelopMentor http://staff.develop.com/richardb/weblog
"Claire" <bl****@blahhhhh.com> wrote in message
news:eM**************@TK2MSFTNGP12.phx.gbl... I have a base abstract class A which contains several abstract functions
I then have an abstract class B (derived from A) which overrides a small subset of A's abstract functions
Finally I have a fully functional class C (deriving from B). Class C overrides the (A's) abstract functions not tackled by its ancestor B.
I am complained at by the compiler, that in C, I have not implemented the inherited abstract members defined by A. But I overrode these functions in B!
Is this correct and why?
Claire
public abstract class A { public abstract void Function1(); public abstract void Function2(); public abstract void Function3(); }
public abstract class B : A { public override void Function1() { doodar; } }
public class C : B { public override void Function2() { } public override void Function3() { } // Compiler complains that C has not implemented Function1 }
thanks all, I agree with you, it must have been a typo somewhere. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Dan Sikorsky |
last post by:
If we were to define all abstract methods in an abstract class, thereby
making that class non-abstract, and then override the heretofore 'abstract'
methods in a derived class, wouldn't that remove...
|
by: Brett |
last post by:
I'm still trying to figure out concrete reasons to use one over the other.
I understand the abstract class can have implementation in its methods and
derived classes can only inherit one abstract...
|
by: Joe |
last post by:
My question is more an OOD question. I know *how* to implement both abstract
classes and interfaces. Here's my question - under what circumstacnes does
one use an abstract class and under what...
|
by: Bradley |
last post by:
I'm trying to determine if there's a general rule for when an Interface
should used vs. an Abstract Class. Is there any design advantage to using
one or the other?
Brad
|
by: Sean Kirkpatrick |
last post by:
To my eye, there doesn't seem to be a whole lot of difference between
the two of them from a functional point of view. Can someone give me a
good explanation of why one vs the other?
Sean
|
by: Steve |
last post by:
I am designing a new class hierarchy and I've already run into a bit of a
bump in the road. I have this structure so far;
class CodeGen
class CodeGenHeader : CodeGen
class CodeGenProtocolHeader...
|
by: J.M. |
last post by:
I have a question concerning inheritance: can an abstract (parent) class
have an abstract object? I would like to make a concrete child inherit from
this class by inheriting from this object. Let...
|
by: jason |
last post by:
In the microsoft starter kit Time Tracker application, the data access
layer code consist of three cs files.
DataAccessHelper.cs
DataAcess.cs
SQLDataAccessLayer.cs
DataAcccessHelper appears...
|
by: Miguel Guedes |
last post by:
Hello,
I recently read an interview with Bjarne Stroustrup in which he says
that pure abstract classes should *not* contain any data. However, I
have found that at times situations are when it...
|
by: Mr.SpOOn |
last post by:
Hi,
I'm going to work on a project to represent some musical theory in
Python, in an object oriented way.
I have to manage many elements of music such as notes, intervals,
scales, chords and so...
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |