Click here to Skip to main content
15,906,574 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Why I hate C++ Pin
Munchies_Matt14-Jul-18 4:35
Munchies_Matt14-Jul-18 4:35 
GeneralRe: Why I hate C++ Pin
TheGreatAndPowerfulOz14-Jul-18 7:42
TheGreatAndPowerfulOz14-Jul-18 7:42 
GeneralRe: Why I hate C++ Pin
Munchies_Matt14-Jul-18 19:20
Munchies_Matt14-Jul-18 19:20 
GeneralRe: Why I hate C++ Pin
Nish Nishant13-Jul-18 9:47
sitebuilderNish Nishant13-Jul-18 9:47 
GeneralRe: Why I hate C++ Pin
kalberts14-Jul-18 3:47
kalberts14-Jul-18 3:47 
GeneralRe: Why I hate C++ Pin
Munchies_Matt14-Jul-18 21:44
Munchies_Matt14-Jul-18 21:44 
GeneralRe: Why I hate C++ Pin
kalberts15-Jul-18 23:13
kalberts15-Jul-18 23:13 
GeneralRe: Why I hate C++ Pin
kalberts16-Jul-18 0:39
kalberts16-Jul-18 0:39 
Munchies_Matt wrote:
what is the big difference bewtween operator overloading and virtual functions
Huge
Implementationwise: Yeah, probably, in most compilers. Not necessarily.

On an abstract level, for the user: Not very much. Both mechanisms provide similarly identified operations to be interpreted differently for different types/classes. The intention is that the implementations for various types shall have similar semantics, but it doesn't have to be.

In my "childhood engineering years" (i.e. after graduation) I was programming in a Pascal-inspired proprietary language which allowed a left argument as well as right arguments, and a single right argument didn't require parentheses. Furthermore, the identifier syntax for functions allowed a big selection of special characters and Functions could be overloaded. "+" was a perfectly fine name for a function that could take MyComplex left and right arguments, or a MyComplex left and (float: re, float: im) right arguments. Conceptually, predefined "+" functions for int+int, int+float, ... were just like user functions. (Obviously, the compiler compiled wellknown builtin functions like these quite differently from those that were actually user written.)

I made a function library for all assignment functions (like C's =, ++, -- and so on) for struct types, that updated the reference count and triggered whenever an object was freed with more than one reference to it, or the reference count went to 0 in a non-free operation. This was for development/debugging only; for production work the library (with its noticable overhead) was omitted and the "simple" assignments took their place, as the default implmentation for the assignment functions.

This language wasn't a fullblown OO language; it didn't have a 'virtual function' concept. Yet having worked with overloaded "AddToList(MyComplex)" and overloaded "MyComplex + MyComplex", using identical mechanisms for the two, certainly blurs the distinction between overloaded operators and overloaded functions. Adding virtual functions on top of that doesn't make a very large conceptual difference.
GeneralRe: Why I hate C++ Pin
11917640 Member 14-Jul-18 21:30
11917640 Member 14-Jul-18 21:30 
GeneralRe: Why I hate C++ Pin
KBZX500016-Jul-18 2:34
KBZX500016-Jul-18 2:34 
GeneralRe: Why I hate C++ Pin
Munchies_Matt16-Jul-18 3:04
Munchies_Matt16-Jul-18 3:04 
GeneralRe: Why I hate C++ Pin
KBZX500017-Jul-18 21:32
KBZX500017-Jul-18 21:32 
GeneralRe: Why I hate C++ Pin
englebart16-Jul-18 3:40
professionalenglebart16-Jul-18 3:40 
GeneralRe: Why I hate C++ Pin
Andy Hoffmeyer16-Jul-18 3:51
Andy Hoffmeyer16-Jul-18 3:51 
GeneralRe: Why I hate C++ Pin
Munchies_Matt16-Jul-18 4:03
Munchies_Matt16-Jul-18 4:03 
GeneralRe: Why I hate C++ Pin
Steve Naidamast16-Jul-18 4:08
professionalSteve Naidamast16-Jul-18 4:08 
GeneralScrum: 1518 ? Pin
BillWoodruff13-Jul-18 2:37
professionalBillWoodruff13-Jul-18 2:37 
GeneralRe: Scrum: 1518 ? Pin
Rage13-Jul-18 3:03
professionalRage13-Jul-18 3:03 
GeneralRe: Scrum: 1518 ? Pin
MacSpudster13-Jul-18 9:23
professionalMacSpudster13-Jul-18 9:23 
GeneralRe: Scrum: 1518 ? Pin
BillWoodruff13-Jul-18 21:38
professionalBillWoodruff13-Jul-18 21:38 
GeneralWatching a horror movie... Pin
CodeWraith13-Jul-18 2:06
CodeWraith13-Jul-18 2:06 
GeneralRe: Watching a horror movie... Pin
OriginalGriff13-Jul-18 2:31
mveOriginalGriff13-Jul-18 2:31 
GeneralRe: Watching a horror movie... Pin
CodeWraith13-Jul-18 2:56
CodeWraith13-Jul-18 2:56 
GeneralRe: Watching a horror movie... Pin
OriginalGriff13-Jul-18 4:17
mveOriginalGriff13-Jul-18 4:17 
GeneralRe: Watching a horror movie... Pin
  Forogar  13-Jul-18 4:26
professional  Forogar  13-Jul-18 4:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.