|
... in the first version, the explicit return type is only needed if the operator+ is ambiguous. ( and if the procs are only overloaded on primitive return types like char and bin. in practice, one proc may return a string, others would return different data structures. In such a case, operator+ is not ambiguous. ) ...
Anyway, I am thinking that the need for procedure overloading may just be a placeholder for the need for namespaces. Where two procs, in two different include files, are allowed to have the same name because their arguments are different. In such a case, namespaces would be a better way to allow the procs to have the same name:
Using overloading to distinguish two procs: PrintOrder( PurchaseOrder_DataStruct ) ; PrintOrder( CustOrder_DataStruct ) ;
Better to use namespaces: purchasing::PrintOrder( arg1 ) ; customer::PrintOrder( arg1 ) ;
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.