Below is the perhaps most simple example of a virtual function in C++:  #include &lt;iostream&gt;  class A { public:     virtual void f() {         std::cout &lt;&lt; "A";     } };  class B : public A { public:     void f() {         std::cout &lt;&lt; "B";     } };   int main() {     {         // calls f() in derived class         A* a = new B();         a-&gt;f();     }     {         // calls f() in base class         A a = B();         a.f();     } }   The output of this program is BA. I expected it to be BB, i.e. call the base class in any case. Why does using a base class pointer make a difference here? I didn't find the explanation in the standard.
Someone mentioned it in the IRC as the slicing problem.
What is the term for taking it out on someone even though you will be harmed by this too? When you are so mad at someone that you make a bad decision, even though you will be harmed by it as well, in order to harm that person; is there a good term for this?   For example burning $100 because he owns $20 of it. How long do you get to use a UK standard visitor visa from time of issue or is it valid for entry indefinite I am going to apply for a standard visitor visa for my girlfriend to enter UK. If it is issued how soon does it have to be used after issue, ie. validity until time of entry? I am trying to install  under Wine. The program setup continually requests proxy settings. My broker tells me this shouldn't happen, and is a problem on my end. Here is what I have tried to attempt to solve this error:   I have gone into Network settings and proxy is set to none. I have looked in Wine Regedit and proxy_enable is set to 0. I have checked the firewall settings on my modem. I have tried reinstalling wine. I have installed lib32nss-mdns I can log on to my modem in iexplore using the gateway ip but thats it I've set my DNS to 10.0.0.138 to reflect the gateway I've set up a 32 bit Wine prefix   How should I proceed in solving this? What's the difference between the 'ref' and 'out' keywords? I'm creating a function where I need to pass an object so that it can be modified by the function. What is the difference between:  public void myFunction(ref MyClass someClass)   and  public void myFunction(out MyClass someClass)   Which should I use and why? I usually disconnect my cellphone from the charger some time after it's fully charged because I'm afraid the battery could lose capacity over time if I don't. However, I believe modern electronics should be able to handle this kind of scenario and automatically stop charging the battery once it's full. Does this apply to modern Android phones? Or do I need to continue disconnecting it all the time? PDO's FETCH_INTO $this class does not work How do I locate all files that include specific word as part of name and end with specific extension? Which livestock is the most efficient food source? SQL Server FOR XML Enclosing Element? In Captain America: Civil War, T'Challa takes the mantle of the Black Panther after his father is killed. As the Black Panther, he appears to have enhanced abilities.  In , the Russos talk about T'Challa having superpowers and being enhanced during Civil War     JOE: It can absorb the energy, so it’s much harder to damage him as a character, and you can see that in the movie he can take a lot of punishment including bullets to the face. He is very well trained. He’s from one of the wealthiest countries on the planet, so there’s great infrastructure there; very technologically advanced country. So he’s been trained at the highest levels to fight, but he also has his own superpowers, which derive from the mythology of his nation. Those will be explored more in Black Panther, it’s clearly evident when he’s able to fight the Winter Soldier out of costume, and go toe-to-toe with him, that he is an enhanced individual.    In Black Panther, we see that in order to become the Black Panther,       one must imbibe juice from the heart-shaped flower and visit the spirit plane after being buried.   But before this,       T'Challa must have his Black Panther powers removed prior to the ritual combat challenge, which he does twice in the film.   This raises the question of how T'Challa could have possibly become the Black Panther abroad - or if he even really had.  How did Black Panther have his powers during Civil War? says:  Bash attempts to determine when it is being run with its standard input connected to a network connection, as when executed by the remote shell daemon, usually rshd, or the secure shell daemon sshd. If Bash determines it is being run in this fashion, it reads and executes commands from ~/.bashrc, if that file exists and is readable.  This Bash sources ~/.bashrc: ssh user@host :  But this Bash sources ~/.bash_profile: ssh user@host  I don't see a difference in these two commands according to the spec. Isn't stdin connected to a network connection in both cases? Will I be demoted to a lower league in Starcraft 2 if I don't play? I've just been promoted from platinum league to diamond and master pretty fast (in 4 vs 4). This was totally amazing for me but I'm afraid I will be demoted again to a lower league as fast as I came higher.   If I don't play any 4 vs 4 anymore, will they demote me to a lower league automatically or do they only do so, if I play? I want to detect when someone is building a lever, then replace it with another lever that has the canplaceon tag so it can be placed on a redstone_lamp  How can I clear the crafting item and replace it with one that has a canplaceon tag? Label and caption without float I’d like to have an environment that works much like a float, except that it doesn’t float.  That is, in fact, I’d like to be able to define an environment that has a label and a caption.  I explicitly do not want to use a floating environment, though. For one thing, floats do many things fancy which I just don’t need, nor want (such as spacing) and for another, floats have their share of problems (for example consider the problem of ).  Is there a ready-made way to achieve this? Of course, I could always write my own based on the result of the other answer, i.e. harnessing \refstepcounter. But I’m not sure how to use that, documentation is scarce, and I’d prefer an existing solution. What documentation is needed for a tourist to drive a US citizen's car? 1) a ten years old boy is sitting on the couch.      2) a ten year old boy is sitting on the couch.      3) a ten-years old boy is sitting on the couch.      4) a ten-year old boy is sitting on the couch.   Which is correct? Dynamic Symlinks I have built my app for different architectures and would like to create a "dynamic symlink" which takes me to the right version based on a variable.   If the machine I am currently logged in to, is x86, then the symlink should take me to that build.  A mocked example of what I want to do:  $ uname -i x86_64  $ ls -ltr  lrwxr-xr-x  1 dogbane gg     4 Feb 16 15:40 mylink -&gt; @sys/ drwxrwxr-x  2 dogbane gg  2048 Feb 16 15:40 x86_64/ drwxrwxr-x  2 dogbane gg  2048 Feb 16 15:40 i386/  $ cd mylink  $ pwd -P ~/x86_64   Is this possible?   I know I can use cd $(uname -i), but want something simpler. Unary operator expected #!/bin/bash  SUBJECT="WARNING CPU USAGE HIGH" TO=gmail id MESSAGE=/tmp/messages echo "#######################" &gt; $MESSAGE echo "CPU statistics as follows.." &gt;&gt; $MESSAGE mpstat &gt;&gt; $MESSAGE echo "#######################" &gt;&gt; $MESSAGE CPU_USAGE=$(top -b -n1 | awk '/^Cpu/ {print $2}' | cut -d. -f1) [ $CPU_USAGE -gt 85 ] &amp;&amp; mail -s "$SUBJECT" "$TO" &lt; $MESSAGE`   ./cpu.sh: line 11: [: -gt: unary operator expected What might be the reason If $n\times n$ matrix $A$ has eigenvalues $1,-1$ and $n\times n$ matrix $B$ also has eigenvalues $1,-1$, can I then say something about eigenvalues of $AB$ and $BA$? Boarding a train in India at another station I have booked a ticket on a train from Mumbai to Chennai and boarding at Pune. Since my schedules have changed, I will be in Mumbai on that day. Can I board the same train in Mumbai in my own ticket and claim the seat/berth?