473,326 Members | 2,090 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

override non-static method with a static one

Joe
I have a base class with all abstract methods. I need to inherit from this
base class but the new class will have all static methods. Is there a way to
do this?

I tried using new but then it complains that the base method hasn't been
implemented.

Thanks,
Joe
Nov 16 '05 #1
3 2088
Joe <J_no_spam@_no_spam_Fishinbrain.com> wrote:
I have a base class with all abstract methods. I need to inherit from this
base class but the new class will have all static methods. Is there a way to
do this?


No. You could override the abstract method with something which just
calls a static method though.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #2
Abstract base classes are just like interfces, so if u derive from it ,
first u should do is to implement all virtual functions of abstract class.

Then u can use the these virtual functions by creating an instance of your
new class, if u want to use the static methods, just call them using the
your class (no need to use new-no need to create an instance-)
Nov 16 '05 #3
Joe
I already have one class that implements the base class. This other class is
a static wrapper to call the implementation class. The implementation is
actually a remote object. Now you're probably wondering why do this all over
again instead of just using code generated from soapsuds. Well the reason is
because I need to do some additional work before making the actual call to
the server.

I'll mess around and report back on how I ended up.

Thanks,
Joe

"Coder" <oa***@st.cs.deu.edu.tr> wrote in message
news:u3**************@tk2msftngp13.phx.gbl...
Abstract base classes are just like interfces, so if u derive from it ,
first u should do is to implement all virtual functions of abstract class.

Then u can use the these virtual functions by creating an instance of your
new class, if u want to use the static methods, just call them using the
your class (no need to use new-no need to create an instance-)

Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Matt | last post by:
Hello, I'm trying to implement the design below. I'd prefer to use commented operator+() in class Number instead of the associated, uncommented operator+(), but as I understand Covariant Return...
11
by: Simon Shutter | last post by:
Forgive me if I am posting to wrong newsgroup and for a couple of loaded questions. First, from what I understand, one of the advantages of XHTML/CSS is the ability of screen readers/braille...
1
by: Paul E Collins | last post by:
I am writing a class that inherits from TextBox. My class, UndoTextBox, extends the standard control by enabling multi-level undo and redo operations. Annoyingly, some of the affected properties...
4
by: Tim Mulholland | last post by:
I've come across a bit of an annoyance i'm hoping someone can explain and/or get me past. I'm overriding the Text property on a user control i'm writing that inherits from...
7
by: ad | last post by:
When a class (say class1) inherited form another class (Class0). The constructor in the class0 will be executing before the constructor of class1. Can we over the constructor?
5
by: Marcel Hug | last post by:
Hi NG ! I'm new in C# and I'm reading a book about the fundamentals and concepts. In the chapter Methods it's written to use virtual, if i would like to override the method in a subclass. This...
6
by: Ole Nielsby | last post by:
Given a class hierarchy: class A{public: virtual void m();}; class B : public A {public: virtual void m();}; class C : public B {public: virtual void m();}; //overrides m() class D : public B...
5
by: =?Utf-8?B?V0o=?= | last post by:
If I have a class A that has a virtual public function DoSomething() Class A { public: virtual void DoSomething(); } then I override this function to protected is class B Class B: public...
8
by: puzzlecracker | last post by:
The statement is taken from FAQ . What about non-virtual functions? Can they be overriden? I still don't see a good justification to prefer private inheritance over composition. In fact, I have...
2
by: dolphin | last post by:
Hi everyone . I am confused about the different between override overload and hide. May be I have a wrong opinion, I always think that hide is very similar with override. Both of them call the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
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...
1
isladogs
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...
0
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.