Everything a human does is selfish, at least on some scale, but there are ways to provide selfishness to self via proxy, which's the biggest thing that's required for this to be true, is the acceptance of this as a basic fact, that humans, can, and will, project their desires for themselves onto another in their place.
For example, sacrificing oneself for someone they love (be it a child, a lover, or some other relationship), though they themselves are lost, they have projected their own desires onto their proxy of self (their other half or whotever they feel 'completes' them) as if it was their own self.
In short, yes, yeu may be gone, but they will live on in yeur name.
The difficult issue here is that not everyone provides this proxy status upon all individuals at all times or in all manners and sense of strength.
One person may consider only themselves and noone else. They are considered selfish.
Another person may go one step out; they consider themselves and immediate blood relatives and family, marriage, etc, but nothing else. They are considered good people though, despite being only one step outwards. These are individuals where they may be willing to let 100,000 people die, so long as they save the one person THEY care about, it doesn't matter if the world burns in the process. Honestly, this's quite selfish of an attitude, yet it's commonly portraited as selfless in movies and north american media.
This can expand outwards further in many layers; from friends, acquaintances, to race, to religion, nationality, gender, species, life in general, inanimate objects.
For examples...
Race -> Racists who associate with only those they consider to be the 'same' as them. Others have no intrinsic value and are irrelevant. They project themselves onto their 'group', and consider damaging a member of ones' race to be damaging themselves, either directly or indirectly.
Religion -> A current topic being the depictions of muhammud or however his name's spelled, pisses of those of his religion as if it were a direct insult to them, when honestly, it's only an insult to the one guy. They project themselves outwards onto a religious group/concept as if it were their own selves. An action taken, though it may doom themselves (if an extremist, not everyone is durr, so don't assume I don't have this stipulation in here XD ), will benefit their religion, thereby supporting themselves in the end.
Nationality -> When the WTC was attacked by terrorists, many in the USA took it as a direct attack against themselves personally, and many were willing to hurt anyone outside of their nation, so long as their 'people' were safe. There were alot of bad cases of racism immediately after the WTC with people commuting whot they believed to be 'selfless' acts of martyrdom, when really they were only saving their projected self image. Nazi's in WW2 were another example; the leadership didn't really HATE other countries so much as it just considered germans to deserve the absolute best, and was willing to kill everyone off if it made germany strong. It wasn't for them, themselves, but for their friends, their relatives, their country, it was all selfless... except it really wasn't.
We can extend this even further; there are those who are willing to harm other creatures, not for need of survival, but for entertainment. They have no connection with anything beyond their own species. Others, such as many environmentalists and animal rights activists, feel direct connection with species outside their own - they help themselves via proxy by helping another creature which they project themselves onto. It may not be the creature itself, but a cause, a thought, or an idea; tying oneself to a tree to prevent logging isn't so much the need to stop a logger from hurting ONE tree, but to emphasize an idea by personifying it as an extension of their own self.
This can even be extended outwards to the entire planet as a whole, in extreme cases, despite it's not even technically a living entity as such.
But this's just examples of more extreme cases... it all comes down to oneself being able to help ones' own self by detaching ones' views toward oneself and projecting onto another, be it an individual, an idea, a group, or an icon.
In so protecting or aiding their projected self, they are aiding themselves, even if it is at direct cost to self.
Soooo if yeu were to go back to the original example, of sacrificing yeurself to save a loved one, yeu aren't really sacrificing yeurself so much for *THEM* selflessly... as yeu are turning them into a proxy of yeurself, and thereby helping yeurself indirectly. Sure, yeu may die, but they live on in yeur stead, and specifically, do so by carrying part of yeu with them in a sense. Yeu live on, despite being dead.
We are geared as a species for survival. The race requires all forms of selfishness though, proxy on many scales, and on a self scale. Killing yeurself is generally bad, since it means one less member of yeur species running around... however, if it's considered to be valuable enough, such as saving several others, it's worth the risk.
A great example here is someone inside a burning building, and 10 people outside. Chances are 9 of them will NOT go into the building; on average only ONE will go in to try to rescue the other. It's a double or nothing bet. If yeu come out successful, or break even, yeu've either gained one, or lost nothing. If yeu loose, yeu loose one more than yeu would've otherwise. Numerically speaking, this means yeu have 2/3rds of a chance of either profit or no loss and only 1/3rd chance of loss. In terms of trying to perpetuate the species, it's worth the risk.
Sending a SECOND person in, however, would pose too high a risk, and ruins the equation. This cutoff point will make it unlikely for others to step forwards, with the assumption that someone else is already taking care of it, and may actually manifest as direct conscious thought within their minds.
If noone went in to save the person in the building, eventually someone'll notice noone's doing anything, and will usually try to help by themselves.
This isn't always the case, but generally, the idea is for the species to try to keep themselves alive as a whole. Sometimes this means being "selfish" and keeping yeur own self alive. Other times, this means self sacrifice for a greater whole. Both are essential in order for the species to prevail overall in the end.
And honestly, we need MORE selfish people than we do "selfless" ones, or else 10 people run into the burning building, and they all die, now yeu're short 11 people instead of 1.
So yeah, we're not REALLY being truly selfless, each and every action is designed to bring pleasure, contentment, ease of conscience, or some benefit to self, directly, or indirectly, and if need be, via projection onto a proxy of self to enable such a decision.
Any time yeu think "if that were me", it's self projection, and yeu're helping yeurself, not them, as a more clear example, though by far not the only one.
So yeah, we're all selfish, but even so, that's not a bad thing. As with the burning building scenario, we need both the selfish and the selfless. Without a mixture, we'd have died out long ago. And honestly, by statistical requirement on a global scale for species self preservation, we require more selfish people than we do selfless.
Which's exactly whot we have.
It's worked well so far, even if it does lead to wars from time to time, but even those come down to territorial or resource disputes, or a religious belief which's essentially resource of the afterlife for eternal perpetual survival of the species. In the end, if there's not enough to go around for EVERYONE, yeu have to 'thin out the herd' a bit... which we do on our own naturally, quite adeptly. Since we've gotten more people, our little tribal disputes have gotten larger as well. How much do yeu want to bet in WW3 we wipe out several BILLION people, since we've swelled in population so much since WW2? If the world can't sustain all of us, we'll naturally cull ourselves of the weak so that the strong survive, and perpetuate the species as a whole, even if it requires sacrificing alot of us to do it.
It's really rather remarkable to think about, just how well built we are for survival. We are designed from the ground up to try to survive. Our bodies are designed to be difficult to damage (put yeur hand over yeur eye... notice that bone structure around it? It's designed to give yeu the maximum amount of awareness of surroundings visually, while still protecting the eye itself, two forms of protection equally distributed for maximum effect), our emotions and instincts are designed to make us react to keep either ourselves alive, or those who will create more (women and children) alive, and even in our bloodiest moments of self damaging, such as wars, we are still attempting to preserve whichever path is most likely to suit our survival long term.
See... this is the kind of thing that should make yeu wonder about intelligent design. Yes, evolution is possible to create some aspects of this, but there's stuff built unto our minds and instincts which assume situations which wouldn't've even occurred 100 years ago. Evolution doesn't work that fast... we were built with crap in mind that couldn't've been predicted at the time of creation.
Doesn't necessarily mean there's a god or anything, but it is rather impressive just how automated we really are. I mean, we've been supposedly left alone pretty much for about 2000 years and so far, have only managed to make MORE of us, despite that we've been trying to kill ourselves off in the process.
I guess, all I can really say, is selfishness is an incredible trait of species survival, and has been doing an amazing job of it for thousands of years, and seems more than adaptable enough to handle new situations as they present themselves.
We are selfish. It's not a bad thing. Though it does get on peoples' nerves if yeu get a little TOO selfish.