473,327 Members | 2,094 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,327 software developers and data experts.

inheritage: possible to call the original function ?

hi,

i have two classes:

class A
{
public:
virtual Push (void *p);

};

And the other one:

Class B : Public A
{
public:
virtual Push (void *p);
}
What i want to do in the Push() in class B, is that i want to do some
additional checking in the start of the function - and the i would like to
call the original code for Push().

Is that possible, can i somehow call the original Push() (the one definded
in ClassA) ? the problem im facing is ofcourse, that when i overrides the
code for Push() it will override it all, so i have to duplicate the code if
i want it to work.

Hope you can understand - and hope you can help - thanks :)
Jul 23 '05 #1
3 1093
* mandatory:

class A
{
public:
virtual Push (void *p);

};

And the other one:

Class B : Public A
{
public:
virtual Push (void *p)
{
A::Push( p );
}

}


--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 23 '05 #2
mandatory wrote:

hi,

i have two classes:

class A
{
public:
virtual Push (void *p);

};

And the other one:

Class B : Public A
{
public:
virtual Push (void *p);
}

What i want to do in the Push() in class B, is that i want to do some
additional checking in the start of the function - and the i would like to
call the original code for Push().

Is that possible, can i somehow call the original Push() (the one definded
in ClassA) ?


Yep.

void B::Push( void* p)
{
...
A::Push( p );
}
--
Karl Heinz Buchegger
kb******@gascad.at
Jul 23 '05 #3
"Alf P. Steinbach
{
A::Push( p );
}


Thanx alot Alf :)
Jul 23 '05 #4

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

Similar topics

20
by: svend | last post by:
I'm messing with some code here... Lets say I have this array: a1 = ; And I apply slice(0) on it, to create a copy: a2 = a1.slice(0); But this isn't a true copy. If I go a1 = 42, and then...
3
by: Angel | last post by:
Hello again (and again, and again...) I think I'm getting closer to solving my initial problem of calling unmanaged code. I managed to call the functions with user-defined structs w/o getting any...
5
by: Summa | last post by:
Hi, Can I somehow specify that Class A can inherit from Class B *and* Class C? -- Thanks, Summa
5
by: Chris Ochs | last post by:
It doesn't currently seem possible to switch between different users using SET SESSION AUTHORIZATION. If I log in as the superuser and switch to another user that works, but if I then switch to a...
4
by: aninnymouse | last post by:
I'm using a library that provides the following function which traverses the graph and calls a provided callback function on each visited vertex: void depth_first_search(Graph *graph, VertexCB...
9
by: CryptiqueGuy | last post by:
Consider the variadic function with the following prototype: int foo(int num,...); Here 'num' specifies the number of arguments, and assume that all the arguments that should be passed to this...
6
by: tgnelson85 | last post by:
Hello, C question here (running on Linux, though there should be no platform specific code). After reading through a few examples, and following one in a book, for linked lists i thought i would...
21
by: coolguyaroundyou | last post by:
See the below code: void func(int x) { printf("%d",x); } int main() { int j=0;
3
by: monojohnny | last post by:
Hi, I know you can do stuff with introspection to gather up passed-in args for a Javascript function and that you can list all defined functions like: function a(abc,xyz,zzz) {...
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...
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
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...
1
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)...
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.