473,546 Members | 2,243 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1100
* 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
3089
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 alert(a2) I will see 42 there too. I'm doubting, but I was
3
2439
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 run-time exceptions. The problem is that I'm receiving a Failure return (it returns 1 = "Failure"). I have a feeling it may be that the function's...
5
1853
by: Summa | last post by:
Hi, Can I somehow specify that Class A can inherit from Class B *and* Class C? -- Thanks, Summa
5
2060
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 second user in succession I get permission denied when I try to select from a table that the user does have access to. Following is a cut and paste...
4
1706
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 callback, void *data); Can somebody tell me how I can create a function that implements an interator iterface using the above function. I'm hoping...
9
3263
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 function are of type int. (My question has nothing to do with the definition of the function foo, so don't bother about it.) If I call the function...
6
4145
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 try my own small program. The problem is, I seem to be having trouble with memory, i.e. sometimes my program will work and display the correct output,...
21
479
by: coolguyaroundyou | last post by:
See the below code: void func(int x) { printf("%d",x); } int main() { int j=0;
3
3735
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) { print(arguments); //etc }
0
7507
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7698
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7947
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7461
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5080
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3492
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3472
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1922
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
747
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.