How can i resolve the logical error in destruction of objects? Here i am faced with problem in destructor of objects. In the program given below i am trying to make object with the base class pointer dynamically and when i am trying delete that pointer than pointer just delete object of A. So how can i delete all the objects at the end of program?  class A{          public:             A(){             cout&lt;&lt;"Object A is created "&lt;&lt;endl;             }             ~A(){              cout&lt;&lt;"Object A is destroyed"&lt;&lt;endl;              }        }; class B{         public:           B(){           cout&lt;&lt;"object B is Created \n";           }           ~B(){            cout&lt;&lt;"Object B is Destroyed"&lt;&lt;endl;            }        }; class C{         public:           C(){           cout&lt;&lt;"constructor of C class"&lt;&lt;endl;           }           ~C(){            cout&lt;&lt;"destructor of C "&lt;&lt;endl;            }        }; class D:public C, public B, public A{      public:        D(){        cout&lt;&lt;"Object D is created "&lt;&lt;endl;        }        ~D(){         cout&lt;&lt;"Object D is destroyed "&lt;&lt;endl;         }   }; int main() {    A *a;    a = new D();    delete a;    return 0; }
When to use virtual destructors? I have a solid understanding of most OOP theory but the one thing that confuses me a lot is virtual destructors. I thought that the destructor always gets called no matter what and for every object in the chain. When are you meant to make them virtual and why?
Is it possible to add entries to the bibliography based on keyword using Biblatex/Biber and within the document code? I would like to print a bibliography which includes all entries with a certain keyword (and possibly some additional entries).  I know that I can filter by keyword when I print the bibliography using  \printbibliography[keyword=&lt;keyword&gt;]   but this will only print entries which I have cited. I could, of course, use  \nocite{*}   to add all entries to the bibliography and then print just those I want.  However, this will make my .bbl file huge as my database is enormous.  Another possibility is to use Biber or another tool to prepare a document-specific .bib file containing only those entries with the keyword. However, this would need to be recreated if additional entries with the keyword are added to my main database files.  Here's an MWE to play with, annotated to indicate the way I'd like it to work ;), and the disadvantages of the way it (almost) works.  The issue of excluding explicitly cited entries is less of an issue for me. The thing I'd really like to work around is adding the entire database contents to the .bbl.  \RequirePackage{filecontents} \begin{filecontents}{\jobname.bib} @book{new-stuff,     author          =   {Watt, Brian},     title           =   {Happy Times with Penguins},     publisher       =   {Harvard University Press},     address         =   {Cambridge, MA},     year            =   1995,     pagination      =   {section},     keywords        =   {happy}} @book{den-coll,   author                =   {Till, Jr., Dennis E.},     booktitle           =   {Penguin Land and Further North: Human Influence},     title               =   {Penguin Land and Further North: Human Influence},     publisher           =   {Oxford University Press},     year                =   2008,     address             =   {Oxford and New York},     keywords            =   {penguin, human}} @book{old-stuff,   author                =   {Harvey, Jr., Dennis E.},     booktitle           =   {Penguin Land and Further North: Human Influence},     title               =   {Penguin Land and Further North: Human Influence},     publisher           =   {Someone \&amp; Daughters},     year                =   1567,     address             =   {Oxford},     bookpagination      =   {paragraph},     keywords            =   {penguin}} \end{filecontents} \documentclass{article} \usepackage[defernumbers=true]{biblatex} \bibliography{\jobname} \begin{document}  \cite{old-stuff}  % what I would like to work % \nocite[keyword=happy] % \printbibliography  % what does work - except that \cite{old-stuff} is ignored and, more importantly, den-coll is added to the .bbl \nocite{*} \printbibliography[keyword=happy]  \end{document} How does remittance work? How does it differ from direct money transfer? I have a bank account in Germany in which I receive my salary in Euros. I want to deposit a part of it in my Indian bank account for personal savings. My Indian bank account is in INR. As I see it, I have two options:   To use a remittance service that converts my Euros into INR and deposits in my account. I am not sure how it works. The service (which I know is reliable) I signed up for asks me to deposit Euros in a certain account ("funding") which will be converted to INR and deposited in my account. How does that work exactly? Use my bank's service to make a international bank transfer to my account. Is that even possible, given that my Indian account is in INR? Will I incur higher conversion fees and lower exchange rate?   In general, what are the pros and cons of each of the above methods? And are there any other methods? As we all know, air consists of many gases including oxygen and carbon dioxide. I found that carbon dioxide is heavier than O2. Does the volume difference neglect the mass difference? Is it same for all other gases in air or is there another force that keeps all of these gases together?  If I take a breath of a fresh air, will the exhaled air be heavier because of its higher CO2 content? Will it fall on the floor? Cancellation Law for Direct Sums - What is wrong with this argument? Horizontal enumeration in multiple columns Consider the following minimal example:  \documentclass{article}  \setlength{\parindent}{0mm}  \usepackage{paralist} \usepackage{tabto}  \begin{document}  \NumTabs{3} \begin{inparaenum} \item text \tab\item text \tab\item text \tab\item text \tab\item text \tab\item text    \end{inparaenum}  \end{document}   Which results in:    It does exactly what I want, but I was wondering whether it was possible to create an environment, say tabbedEnum so that we can eliminate the use of the \tab, in particular, that the first case doesn't need a tab but all others do. Something of the form:   \begin{tabbedEnum}[3] \item text \item text \item text \item text \item text \item text \end{tabbedEnum} Multiplying Binomial Terms I use Chrome across 4 different workstations and I have my extensions synced across all of them.  The problem I have is that one of the extensions () works great if you've got an actual mouse, but on a trackpad on Ubuntu, it just gets in the way.  If I disable it on the Ubuntu machine, it gets disabled on all Chrome installations due to its .  Q: Can I selectively disable an extension on just a single machine? Why square the difference instead of taking the absolute value in standard deviation? In the definition of standard deviation, why do we have to square the difference from the mean to get the mean (E) and take the square root back at the end? Can't we just simply take the absolute value of the difference instead and get the expected value (mean) of those, and wouldn't that also show the variation of the data? The number is going to be different from square method (the absolute-value method will be smaller), but it should still show the spread of data. Anybody know why we take this square approach as a standard?  The definition of standard deviation:  $\sigma = \sqrt{E\left[\left(X - \mu\right)^2\right]}.$   Can't we just take the absolute value instead and still be a good measurement?  $\sigma = E\left[|X - \mu|\right]$ How to prove Euler's formula: $e^{i\varphi}=\cos(\varphi) +i\sin(\varphi)$? Could you provide a proof of Euler's formula: $e^{i\varphi}=\cos(\varphi) +i\sin(\varphi)$? Interpreting the 'metric' column in routing table I'm a little confused about the output I'm seeing in my routing table, particularly the 'metric' column:  $ route -n Kernel IP routing table Destination     Gateway         Genmask         Flags Metric Ref    Use Iface 0.0.0.0         192.168.0.1     0.0.0.0         UG    0      0        0 wlan0 172.16.35.0     0.0.0.0         255.255.255.0   U     0      0        0 vmnet1 192.168.0.0     0.0.0.0         255.255.255.0   U     9      0        0 wlan0 192.168.82.0    0.0.0.0         255.255.255.0   U     0      0        0 vmnet8   According to the man page, metric indicates the 'distance' to the target. I was a little confused about what exactly "target" was. I assumed it was my router (it goes to gateway 0.0.0.0, which then goes to my router at 192.168.0.1). Thus, I expected the metric to be a single hop to my router. However, it's 9! Why is this so number high? NSXMLParser chokes on ampersand & Lazy Eye in Infants, Preparations for Seeing a Specialist My youngest (14 months) has started showing signs of either strabismus or ambylopia (both commonly referred to as "lazy eye", where one eye seems to track differently than the other when the child is tired or isn't focusing).  We're going to see an ophthalmologist once the pediatrician weighs in and recommends one, and I'm interested in suggestions for what I should look for in an ophthalmologist, and in what we should do to prepare for the visit.  Particularly, how important is it that we find one that specifically mentions these conditions as things they specialize in?  They're fairly common conditions (affecting over 4% of children), so I would expect most pediatric ophthalmologists to have as one of their main purposes helping to diagnose and treat lazy eyes; but many do not mention them in their list of specializations.    And, in terms of preparation, do we need to keep track of time or length of lazy eye bouts?  Should we take any videos?  Our pediatrician hasn't noticed this in her periodic checks, but I suspect that he's more focused during these visits (a person he's not that used to, who is talking a lot to him).  I worry the ophthalmologist will have the same problem - not be able to diagnose because of lack of presentation during the visit. How does delete[] "know" the size of the operand array? Foo* set = new Foo[100]; // ... delete [] set;   You don't pass the array's boundaries to delete[]. But where is that information stored? Is it standardised? If I put a DX lens on a Nikon D700, it will reduce megapixels to 5.1.  I understand that FX pixels are about 2.5 times larger than DX pixels. Would I be correct to assume that, therefore, my FX image using 5.1 megapixels will produce quality equivalent to at least a 10 megapixel image on a DX camera, all other things being equal? Cardinal of quotient rings of gaussian integers. It is known that $\mathbb{Z}[i]$ is a PID and that $\mathbb{Z}[i]/(a+bi)\mathbb{Z}[i]$ is finite for all $(a,b) \in \mathbb{Z}^2\backslash \{(0,0)\}$.  My question :      Is there any result on the cardinal of  $\mathbb{Z}[i]/(a+bi)\mathbb{Z}[i]$ ? Tabular with p type columns to fill page width In the midst of attempting to prove that for a commutative ring $A$ with identity, and an ideal $I$ of $A$, $I = \operatorname{rad}(I)$, where $\operatorname{rad}(I) = \{x: x^m \in I, m &gt;0\}$, implies that $I$ is an intersection of prime ideals, I've run into a little bit of confusion.   An answer to another question on this site, , indicates a strategy that I am attempting to use. I know that if $x$ is an element of $A\setminus I$, then so too is $x^m$ for any positive integer $m$. I use this fact to consider a subset $X = \{x^m : m &gt; 0\}$, which is closed under multiplication, and use Zorn's lemma to find an ideal of $A$ containing $I$ maximal with respect to the constraint that said ideal, $J$, is disjoint from X.  I want to prove $J$ is prime by contradiction. I suppose that $J$ were not prime; this also means that $J$ is not maximal in $A$. Then there would exist two elements, $f$ and $g$, of $A$ so that $fg$ is in $J$, but neither $f$ nor $g$ is in $J$. Following the prompting of the aforementioned answer, I know that $J + \langle a\rangle$ and $J + \langle b\rangle$ would be ideals strictly containing $J$, and since J is the maximal ideal disjoint from $X$, both $J +  \langle a\rangle$ and $J + \langle b\rangle$ contain at least some elements of $X$ (I am tempted to say all of them, but I'm not entirely sure that's true, in case for example $\langle a\rangle$ started containing powers of $x$ at $x^2$, in which case it isn't necessarily true that $\langle a\rangle$ contains $x$ itself), and so both $\langle a\rangle$ and $\langle b\rangle$ must themselves contain elements of $X$.  And this is where I am stuck. I feel like there is something I should know about multiplicative subsets of rings that would help me arrive at the desired contradiction, but I can't remember what it might be. I'd like to download automatically tons of papers listed on .bib file so I'm trying to find a way to facilitate the process by, e.g. I import or input to a tool a certain .bib file which contains a list of literature, the output is the literature's .pdf file. Any idea to do so? What's the full-form & significance of USS & ISS prefixes in name of Star Trek starships? In the Star Trek normal universe, almost all of Starfleet's starships were named with the prefix USS: Count from . Some popular ones: USS Enterprise - series, USS Stargazer, USS Exeter, USS Defiant, USS Excelsior, USS Voyager, USS Titan, USS Reliant, USS Equinox, USS Grissom, USS Relativity, etc.  In the mirror universe, Starfleet's starships were named with the prefix ISS. We don't have a big list, but we do see these: ISS Enterprise NX-01, ISS Enterprise NCC-1701, ISS Avenger.  What's the full form of USS &amp; ISS in Star Trek canon?  In the real world, the US Navy uses USS in ship names, which is reasonable as "United States Ship", but why is it used in Star Trek canon (in which there's no US to control starships)?  In the mirror universe, USS is replaced with ISS. Why? Does ISS have a meaning opposite from that of USS? youtube-dl failed to extract signature