Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Overload

Status
Not open for further replies.

1rstSol

Programmer
Mar 8, 2005
6
0
0
FR
Is it possible to use overload while functions’ arguments are ‘user object’ type ?
 
don't know why you shouldn't be able to...

what your goin to do anyway?

__________________________________________
a programmer is a tool that converts coffee into code...
aschi666, sthcomputing.de
 
I have to write a visitor design-pattern in which function selection is based on arguments’ type.

-------------
| Visitor |
|-----------|
|Visit(Elt) |
|Visit(EltA)|
|Visit(EltB)|
-------------
|____________________
| |
---------------- ----------------
| VistorCountA | | VistorCountB |
| ------------ | |---------------
| Visit(Elt) | | Visit(Elt) |
| Visit(EltA) | | Visit(EltA) |
| Visit(EltB) | | Visit(EltB) |
---------------- ----------------


On heritage tree:
---------------------
| Elt |
---------------------
| Accept(Visitor v) |
---------------------
|___________________________
| |
--------------------- ---------------------
| EltA | | EltB |
|-------------------| |-------------------|
| Accept(Visitor v) | | Accept(Visitor v) |
--------------------- ---------------------

In this sample, classes Elt, EltA, and EltB are user object’s type. And I have to write three functions named ‘Visit()’.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top