Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion 'Overloading' Class member functions and Virtual functions
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Ben Bacarisse  
View profile  
 More options Aug 7 2012, 3:35 pm
Newsgroups: alt.comp.lang.learn.c-c++
From: Ben Bacarisse <ben.use...@bsb.me.uk>
Date: Tue, 07 Aug 2012 20:35:50 +0100
Local: Tues, Aug 7 2012 3:35 pm
Subject: Re: 'Overloading' Class member functions and Virtual functions

nvangogh <nvang...@invalid.net> writes:
> Hello,
> My understanding is that a class member function can be overloaded -
> that is to say, it's name can be used more than once so long as the
> parameters are different.

> So is the only advantage of overloading a class member function, the
> fact that one does not have to think up alternative names for the
> functions in a particular class that may do similar kinds of
> operation? Is there a more fundamental reason for overloading a
> function? If not, then it can safely be avoided altogether.

There is no fundamental reason for overloading but it the name of the
function is operator+=, then the advantage of keeping the name is not
inconsiderable.

> On another point, I have been introduced to the concept of 'Virtual
> Functions' via a game project that I am currently working on. In my
> studies of C++ I have not yet reached this particular topic which is
> listed under 'advanced topics' in my book.

> Many open source games seem to have lots of virtual functions in
> them. My question is are virtual functions things that can be avoided
> - albeit by using code that might not be as elegant? Obviously, the
> answer to this will depend upon the particular problem being dealt
> with - but I am hoping for general guidance on this point.

Any feature can be avoided; after all, C++ was first implemented as a
translator that turned C++ into C, but there is no sensible way to avoid
virtual functions if they make sense for a particular program.  They
form part of the core that allows C++ to be used for object-oriented
programs.

--
Ben.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.