Welcome to LQ.
There can be no <space> in the package name :
sudo apt-get install g++ 4.7 : Will reinstall 'g++', i.e. the default (4.4.5?)
If there is a package 'g++-4.7' available, the command must be :
'sudo apt-get install g++-4.7'.
Which OS are you using ? Debian Wheezy ?
Please try the command : g++-4.7 -v
→ → g++-4.7 provides /usr/bin/g++-4.7 , no /usr/bin/g++
http://packages.debian.org/wheezy/am...+-4.7/filelist
Also : You can have as many versions of gcc/g++ as you want,
installed at the same time. They have different file names.
Selecting a version : sudo update-alternatives --config gcc
... Which will change the links gcc/g++ to point to <selected version>.
.