The richest man in the world has met one of the world's elder statesmen. In Johannesburg, Microsoft chief executive and multi-billionaire Bill Gates has attended a youth forum with former South African president Nelson Mandela.

They are two of the world's most influential men, for different reasons. One spent 27 years in prison and walked free to lead his nation into a new democracy, winning a Nobel Peace Prize in the process. The other developed the computer software run on most of the world's computers, and became the world's richest man in the process.

As different as their lives and accomplishments have been, ex-President Nelson Mandela and Microsoft CEO Bill Gates have one thing in common. They have both taken up the same struggle to rid the world of HIV and AIDS. Both men have started charitable foundations that, in addition to their other work, fund AIDS-related projects and research.

Bill Gates and Nelson Mandela met in Johannesburg with a group of about 100 teenagers and young adults to talk about AIDS. Mr. Mandela told them that the future of South Africa lies in their hands, but it is a future in grave peril because of the AIDS epidemic.

"The fight against AIDS will indeed require another social revolution," he said. "Once more the youth of our country are called upon to play a leading role in a social revolution, as they did so heroically in the revolutionary struggle against apartheid."

The special youth AIDS forum was held in one of Africa's most notoriously impoverished and crime-ridden neighborhoods - the Johannesburg district known as Hillbrow. Although it used to be a progressive, integrated inner-city neighborhood, Hillbrow has become infamous for its violent New Year's Eve celebrations, and many South Africans consider it nothing more than a den of thieves and drug addicts.

But Hillbrow also has a medical clinic that is doing important research on AIDS, and a large dormitory housing students from the nearby University of the Witwatersrand, one of South Africa's best. It was the clinic and the students that Mr. Gates and his wife Melinda came to see.

The computer software magnate told the young South Africans in the audience that their country and their continent have the opportunity for tremendous growth and development.

"The world is looking to you not only to lead South Africa, but also to set a model for this entire continent, to take the things that have held Africa back and show that those don't need to hold them back in the future," said Mr. Gates. "But there is this one challenge that could block all of that, and could block your generation from achieving its potential. And in particular, that's AIDS."

An estimated 20 percent of adult South Africans are infected with HIV, and AIDS is believed to kill roughly 600 people a day. As Mr. Mandela put it, the disease is robbing classrooms of both students and teachers.

Mr. and Mrs. Gates are visiting three African countries to learn about the work their charitable foundation is doing to fight AIDS and malaria.

Having just come from visiting a malaria research center in Mozambique, they travel next to Botswana, where the Gates Foundation is funding the nationwide distribution of anti-retroviral drugs, which can allow people with AIDS to live longer and more productive lives.

In South Africa, along with Mr. Mandela and his wife, Graca Machel, they wanted to hear what young South Africans think about AIDS. They also wanted to urge the young people to start speaking openly about AIDS and sexuality because, they said, that is the first step to fighting the stigma and denial attached to AIDS, and eventually to defeating the disease itself.

In the audience were several young people with first-hand experience, preaching the same message. Fatima Bagaria, 26, tested positive for HIV six years ago, when she was a university student herself.

"I thought it was something that's never going to affect me," said Ms. Bagaria. "I came from the right school, I came from the right background, I had the right education. HIV was something that was going to be for people who did not have all of those things. It is not. Nobody is above this disease."

On an emotionally charged morning, the crowd also heard from a 37-year-old woman with full-blown AIDS, so thin she seemed to barely have the strength to stand. Her voice choked with tears as she begged the young people to use condoms if they have sex.

Another speaker, who co-hosted the program, lost both of her parents to AIDS before she was 18, and then as an orphan she faced discrimination from her own community because of the way they died. She exhorted the crowd to accept and love people who have been affected by AIDS, and not to live in denial.

South Africa is a country whose AIDS policy has long been controversial. Mr. Mandela only fully embraced the AIDS cause toward the end of his presidency. His successor, Thabo Mbeki, has been widely criticized by AIDS activists and health workers for failing to implement a nationwide program of anti-retroviral drugs, similar to the one Mr. Gates is funding in Botswana.

But Mr. Gates and Mr. Mandela played down the controversy, focusing on the future instead of the past. Mr. Gates said no country on earth responded to the AIDS crisis quickly enough, and Mr. Mandela said South Africa is beyond petty arguments about which medicines work best.