Thanks for taking the time to look at this question. I was hoping someone could explain a behavior too me of the classes below and maybe a way to fix it. I believe there may be a simple solution to this but I haven't been able to find a solution with the Google machine so far. Consider the code below: void overloadExample() {   class A   {   private:   public:     A(/* args */){};     ~A(){};     int typeone = 1;   };       class B: public A   {   private:   public:     B(/* args */){};     ~B(){};     int typetwo = 2;   };    class foo   {   private:     /* data */   public:     foo(/* args */){};     ~foo(){};     void printer(A atype){std::cout&lt;&lt;atype.typeone&lt;&lt;std::endl;};     void printer(B btype){std::cout&lt;&lt;btype.typetwo&lt;&lt;std::endl;};   };      std::vector&lt;A*&gt; test;   A* atest = new A();   B* btest = new B();   test.push_back(atest);   test.push_back(btest);   foo ptest;   for (size_t i = 0; i &lt; 2; i++)   {     ptest.printer(*(test.at(i)));   }   delete atest;   delete btest; }  output is: 1 1  but I am hoping to somehow get 1 2  My question is why does the object of type B behave as type A? Is there a way to make it call the overloaded function intended for type B as in foo? Update: This question was closed as a repeat of an object slicing question but there is more too the problem which I believe can be solved by
Someone mentioned it in the IRC as the slicing problem.
How can one show that for triangles of sides $a,b,c$ that   $$\frac{a}{b+c}+\frac{b}{c+a}+\frac{c}{a+b} &lt; 2$$  My proof is long winded, which is why I am posting the problem here.   Step 1: let $a=x+y$, $b=y+z$, $c=x+z$, and let $x+y+z=1$ to get   $\frac{1-x}{1+x}+\frac{1-y}{1+y}+\frac{1-z}{1+z}&lt;2$  Step 2: consider the function $f(x)=\frac{1-x}{1+x}$, and note that it is convex on the interval (0,1), so the minimum of   $\frac{1-x}{1+x}+\frac{1-y}{1+y}+\frac{1-z}{1+z}$  is reached when the function takes the extreme points. i.e. $x=y=0, z=1$.    But going back to the fact that this is a triangle, we note that $x=y=0 \implies a=0$ which is not possible, so the inequality is strict. Linear regression best polynomial (or better approach to use)? Any ideas on other polynomials I could successfully use for applying regression? My goal is a solution that has fit error strictly based on the noise. Is this possible since it is a bell-like curve? The tails can be long, short or non-existent. Am I looking for the impossible? Please note it has been a while since I have plunged this far into linear regression.   Anyway, my data points do not fit the $ax+bx^2+c$ polynomial well enough. I would like a replacement for this polynomial to apply regression (or different approach). In the following example, each point misses the fit curve by $20\%$ of the $Y$ range on average (of the data points). I looked at splines, but I do not know how to apply the regression since they look piece-wise.   Example $Y$ values (evenly spaced in $X$). It looks kind of like a bell curve. I would be applying 5 to 50 data points to determine the polynomial coefficients. Ultimately, I am interested in the best $X$ location for the peak based on the data points.     X      Y -40    -21142.1111111111 -30    -21330.1111111111 -20    -12036.1111111111 -10      7255.3888888889   0     32474.8888888889  10     32474.8888888889  20      9060.8888888889  30    -11628.1111111111  40    -15129.6111111111 Difference in sentence meaning between present continuous and simple present constructions This is part of a homework assignment for a real analysis course taught out of "Baby Rudin."  Just looking for a push in the right direction, not a full-blown solution.  We are to suppose that $f(x)f(y)=f(x+y)$ for all real x and y, and that f is continuous and not zero.  The first part of this question let me assume differentiability as well, and I was able to compose it with the natural log and take the derivative to prove that $f(x)=e^{cx}$ where c is a real constant.  I'm having a little more trouble only assuming continuity; I'm currently trying to prove that f is differentiable at zero, and hence all real numbers.  Is this an approach worth taking? A method for the OP to accept comments? Question: What if the author of a question can accept a comment?   The problem:  Time and time again, answers are posted as a comment.  Usually, the person who commented has the best of intention (e.g. it was a trivial answer [to the answerer], and they weren't sure if the OP would immediately edit the question after the comment).  But this leaves the frustrating situation of an unanswered question with a perfectly good answer.  This problem accumulates over the years.     Candidate solution:  The OP can just "accept" the comment, after which a duplicate of the comment is made an accepted CW answer, with a preface indicating that it was originally a comment, e.g. This answer was originally a comment posted by [[blah]] that has been accepted by the author of the question.   Comments on this scheme:   The author of the comment has indicated they're not interested in gaining/losing reputation through their comment (thus CW answer). The original comment is still there. If desirable, the "author" of the accepted question could be a "bot", so the answer is not attributed to a genuine account.  (I suppose it would already be technically possible for Joe Blow to create a script for a bot that creates an answer from a comment in the proposed way.)     A similar question was asked before  (over 3 years ago), and in numerous other questions which have been deemed "duplicates" (,  and ; see also ), so there seems to be demand for such a feature.  The answers to these questions seem (to me, at least) quite weak:   "ask the commenter to add the comment as an answer"   The OP already did this by asking the question in the first place.  And what if the author of the comment doesn't respond (or takes a long time to respond)?  This also adds more chit-chat irrelevant to the question.   "add an answer of your own, referring to the comment, and accept it."   A hacky workaround.  How could this possibly be better than accepting a comment?  (Yet, this is the most up-voted response.)  Moreover, this adds to the user's list of "answers" (thus making the user's page harder to look through).   "When i leave a comment, i do so because i want to leave a comment."   Great; now what about everyone else?  In the immortal words of the FAQ: "Other people can edit my posts?!"  And it's not even an edit, it's copying the post from one box to another (a more hacky version of which is regarded as the "accepted" method). Any Set with Associativity, Left Identity, Left Inverse is a Group Related Link:    Reference: Fraleigh p. 49 Question 4.38 in A First Course in Abstract Algebra     I will present my proof (distinct from those in the link) for critique and then ask my question.  $G$ is a set and $ \times $ is an associative binary operation.  Suppose that there exists a $e \in G$ such that, for all $a \in G$, $ea = a$ and $a^{-1}a = e$ for some $a^{-1} \in G$.  Show that for the same $e$, $ae = a$ and $aa^{-1} = e$.  $a^{-1}(aa^{-1})a = (a^{-1}a)(a^{-1}a) = ee = e = a^{-1}a = a^{-1}(a^{-1}a)a$  Since $a^{-1} \in G$, it has a left inverse; apply it to both ends, and we have $(aa^{-1})a = (a^{-1}a)a$.  As a result, $ae$ = $a(a^{-1}a) = (aa^{-1})a = (a^{-1}a)a = ea$.  For the right inverse, start with $aa^{-1} = a(a^{-1}a)a^{-1} = (aa^{-1})(aa^{-1})$.  Since $\times$ is a binary operation, $aa^{-1} \in G$ and has a left inverse; apply it to both ends, and we have $e = aa^{-1}$.  In second comment following the question in the link, Mr. Derek Holt pointed out that the requester did not word his/her question correctly.  Specifically, the identity in the second axiom is not well-defined.     Let $(G, *)$ be a semi-group. Suppose    1. $ \exists e \in G$ such that $\forall a \in G,\  ae = a$;    2. $\forall a \in G, \exists a^{-1} \in G$ such that $aa^{-1} = e$.    How can we prove that $(G,*)$ is a group?    This formulation makes the same technical error as many textbooks. The $e$ in your second axiom is not well-defined. "But obviously it's intended to be the same $e$ as in the first axiom" you reply. But the first axiom does not necessarily specify a unique element $e$. So should we interpret the second axiom as meaning "for some $e$ as in 1" or "for all $e$ as in 1"? –  Derek Holt Sep 17 '11 at 15:31   Was he saying that if, in axiom 1, we have $ae_1 = a, ae_2 = a$, but $e_1 \neq e_2$,  when we get to axiom 2, do we have $aa^{-1} = e_1, aa^{-1} = e_2$, or two different inverses so that $aa_1^{-1} =  e_1, aa^{-1}_2 = e_2$?  I think my wording eliminated the ambiguity.  It does not imply that $e$ is unique, but if $e$ is a left identity and produces left inverses, then it is also a right identity and produces right inverses. I tried really hard on this one; please kindly point out my mistakes. How to print the position How to write the below lines using array?? val1=$(grep 'Thread' Threadout.txt | awk -F&quot;/&quot; '{print $1}')    val2=$(grep 'Thread' Threadout.txt | awk -F&quot;/&quot; '{print $2}')  val3=$(grep 'Thread' Threadout.txt | awk -F&quot;/&quot; '{print $3}')  val4=$(grep 'Thread' Threadout.txt | awk -F&quot;/&quot; '{print $4}')  Threadout.txt contains like &quot;Thread 1/1/25/100&quot; I changed the /etc/environment to add more directories to the PATH variable. But looks like $PATH in double quotes were not expanded and I could find any command from the shell and /usr/bin/command-not-found is run.  $ cat /etc/environment  PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games" PATH="$PATH:/home/user/technical/java/maven/bin" JAVA_HOME="/home/user/technical/java/jdk7"   so from the tty,  $ echo $PATH $PATH:/home/user/technical/java/maven/bin   why did not the expansion happen? Insert results of a stored procedure into a temporary table JavaScript curry: what are the practical applications? I don’t think I’ve grokked currying yet. I understand what it does, and how to do it. I just can’t think of a situation I would use it.  Where are you using currying in JavaScript (or where are the main libraries using it)? DOM manipulation or general application development examples welcome.   mentions animation. Functions like slideUp, fadeIn take an element as an arguments and are normally a curried function returning the high order function with the default “animation function” built-in. Why is that better than just applying the higher-up function with some defaults?  Are there any drawbacks to using it?  As requested here are some good resources on JavaScript currying:    Crockford, Douglas (2008) JavaScript: The Good Parts  (Takes a detour into ML so skip the whole section from “A crash course in ML” and start again at “How to write curried JavaScript”)    (Mr. Resig on the money as per usual)    I’ll add more as they crop up in the comments.    So, according to the answers, currying and partial application in general are convenience techniques.  If you are frequently “refining” a high-level function by calling it with same configuration, you can curry (or use Resig’s partial) the higher-level function to create simple, concise helper methods. How to implement custom icons for my script/addon? Is it possible to use different icons other than the default set and how? How can I determine which process owns a hotkey in Windows? Given a hotkey, how can I find which program owns it? How can the petrification from the Flesh to Stone spell be removed? Show that $\dim H^0(\mathbb{P}^n, \mathcal{O}_{\mathbb{P}^n}(m)) = {n + m \choose n}$ if $m \geq 0$, and $0$ if $m &lt; 0$. This statement came up in an algebraic geometry text with no explanation provided, and I'm trying to understand why it's true.   Thoughts so far:   Since $H^0(\mathbb{P}^n, \mathcal{O}_{\mathbb{P}^n}(m))$ is the vector space of regular sections of $\mathcal{O}_{\mathbb{P}^n}(m)$ over $\mathbb{P}^n$, we can try to find a basis. Since the regular sections are the degree $m$ polynomials in $x_0, \dots, x_n$, it seems like the collection of degree $m$ monomials in $x_0, \dots, x_n$ should work. But I don't see how there are ${n + m \choose n}$ of these. Is it just a basic counting argument that I'm struggling with?  On a side note, I think I understand what global sections of $\mathcal{O}_{\mathbb{P}^n}(m)$ look like, but how can we describe the regular sections over a distinguished open set $D(f)$? Is it something like degree $m$ polynomials with denominator $f$? Intuitively it's easy, but hard to prove by the epsilon-delta method:  $$ \lim_{n \to \infty} n x^{n} = 0$$ Bevel is not symmetrical Find the number of ways in distributing $8$ distinct balls into $6$ distinct boxes such that there is at least $1$ ball in each box.  We are well acquainted with the traditional Inclusion-Exclusion principle in solving this and it will come up as $191520$ ways.  I tried in this way:  When we distribute $8$ balls into $6$ boxes we have two possible cases  Case $1.$ There are exactly $2$ boxes with $2$ balls each  Case $2.$ There is exactly $1$ Box with $3$ balls in it.  For Case $1$, the distribution is done by choosing $2$ boxes from $6$ boxes and $2$ balls from $8$ balls and those two balls can be arranged in $2!$ ways. But I require another two balls from remaining $6$ balls to be placed in each of these two boxes which can be done in $\binom{6}{2} \times 2!$ ways. Finally remaining $4$ balls can be distributed in remaining $4$ boxes in $4!$ ways. So total number of ways for Case $1.$ is  $$\binom{6}{2} \times \binom{8}{2} \times 2! \times \binom{6}{2} \times 2! \times 4!=604800$$  For Case $2$, the number of ways is  $$\binom{6}{1} \times \binom{8}{3} \times 5!=40320$$  I am pretty sure the value obtained for Case $2.$ is correct. but I could not find where I went wrong in Case $1.$ Is there a function whose inverse is exactly the reciprocal of the function, that is $f^{-1} = \frac{1}{f}$? Is there a function whose inverse is exactly the reciprocal of the function? That is $f^{-1} = \frac{1}{f}$.  We know that the inverse of a function is not necessarily equal to its reciprocal in general. Is there a simple way to add exFAT support? When I insert a USB stick or camera flash card I get the following error:  unknown filesystem type 'exfat'   Is there a simple way to add exFAT support to Ubuntu without kernel patching? How to get client date and time in ASP.NET?