I’m studying OOP at the moment, and I’ve got this thesis. Because I know that inheriting a subclass from a superclass be like: class superClass : subClass{ } but I’m curious if this is an acceptable form: class superClass : subClass1 : subclass2.  In a nutshell, I want to inherit a subclass from another one. Because what if I get into a problem like there is a subclass and it is inherited from a superclass because they have common data.  Thats fine right?  But here is the catch: What if I need another subclass, which has common data with both of the first subclass and the super or main class?
Since multiple inheritance is bad (it makes the source more complicated) C# does not provide such a pattern directly. But sometimes it would be helpful to have this ability. For instance I'm able to implement the missing multiple inheritance pattern using interfaces and three classes like that: public interface IFirst { void FirstMethod(); } public interface ISecond { void SecondMethod(); }  public class First:IFirst  {      public void FirstMethod() { Console.WriteLine(&quot;First&quot;); }  }  public class Second:ISecond  {      public void SecondMethod() { Console.WriteLine(&quot;Second&quot;); }  }  public class FirstAndSecond: IFirst, ISecond {     First first = new First();     Second second = new Second();     public void FirstMethod() { first.FirstMethod(); }     public void SecondMethod() { second.SecondMethod(); } }  Every time I add a method to one of the interfaces I need to change the class FirstAndSecond as well. Is there a way to inject multiple existing classes into one new class like it is possible in C++? Maybe there is a solution using some kind of code generation? Or it may look like this (imaginary c# syntax): public class FirstAndSecond: IFirst from First, ISecond from Second { }  So that there won't be a need to update the class FirstAndSecond when I modify one of the interfaces.  EDIT Maybe it would be better to consider a practical example: You have an existing class (e.g. a text based TCP client based on ITextTcpClient) which you do already use at different locations inside your project.  Now you feel the need to create a component of your class to be easy accessible for windows forms developers. As far as I know you currently have two ways to do this:  Write a new class that is inherited from components and implements the interface of the TextTcpClient class using an instance of the class itself as shown with FirstAndSecond.  Write a new class that inherits from TextTcpClient and somehow implements IComponent (haven't actually tried this yet).   In both cases you need to do work per method and not per class. Since you know that we will need all the methods of TextTcpClient and Component it would be the easiest solution to just combine those two into one class. To avoid conflicts this may be done by code generation where the result could be altered afterwards but typing this by hand is a pure pain in the ass.
Meta sites in "Your Communities" display different reputation Prove the following equality using mathematical induction: Prove the following equality using mathematical induction: For any integer $n \ge 1$  $$\sum_{i=1}^{n} \frac{1}{i(i+1)} = \frac{n}{n+1}$$  I understand for the base base I need to have $n=1$. If I substituted $n$ for 1 and $i$ for 1 I would get   \begin{align} \sum_{i=1}^{1} \frac{1}{1(1+1)} &amp;= \frac{1}{1+1} \\ \sum_{i=1}^{1} \frac{1}{2} &amp;= \frac{1}{2} \end{align}  As for the inductive step, I inputted $n +1$ but it did not work for me because honestly I did not know what to do with the $i$ and what I should do next.  How would I go about doing the next step and an explanation for $i$ would be helpful. Find $\lim_{n \to \infty} \left[\frac{(n+1)^{n + 1}}{n^n} - \frac{n^{n}}{(n-1)^{n-1}} \right]$ (a question asked at trivia) I have a valid US passport. I will fly Jet Airways to Delhi airport with 9 hours of layover to change to another Jet Airways Flight to Abu Dhabi. Do I need a transit visa? Plot electric potential and field Let's say we have one black hole that formed through the collapse of hydrogen gas and another that formed through the collapse of anti-hydrogen gas. What happens when they collide? Do they (1) coalesce into a single black hole or do they (2) "annihilate" into radiation?  One would expect (1) to be the case if the No Hair Theorem were to hold. So I guess what I'm really asking for is a modern understanding of this theorem and its applicability given what we know today. How to get the center line between two linestrings Where is the track of a ship when it is shipping always in the center of the   between the coasts of Great Britain and France?   I started with 2 linestrings and I created a lot of points on the linestring with a . After that I created a distance matrix with Raster/Analysis/Proximity in QGIS. Finally I created an aspect raster from the output raster.     Is the red line really the "center line" between these two linestrings?  Is there a more efficient way to do this? I'm trying to rotate the blades of a windmill for an animation but the windmill is already at an angle. When I keyframe it on it's own axis (after pressing control + alt + space) and rotate it the blades spin inwards during the animation before coming back at the end. I've tried locking the other axis but that keeps the blades from rotating back to the right orientation. Also, whenever I rotate the object 360 degrees it turns the 360 into a really small number (0.0001) so it plays forward hallway then backwards (with a 180 degree keyframe halfway). Any help would be appreciated!. Do you have any useful awk and grep scripts for parsing apache logs? I can use log analyzers, but often I need to parse recent web logs to see what's happening at the moment.   I sometimes do things like to figure out top 10 ips that request a certain file  cat foo.log | grep request_to_file_foo | awk '{print $1}' |  sort -n | uniq -c | sort -rn | head   What do you have in your toolbox? Can we simply rename an app if they are different versions and keep them both? For example, I have Xcode 4.4.1, and now Xcode 4.5 Golden Master (GM) version is available, but it is also called Xcode (when the .dmg is mounted as an disc image, it shows only one app (or folder), called Xcode)  I think the way is just to double click on the .dmg file, and then drag and drop that app into our Applications folder.  But since the current Xcode and Xcode 4.5GM have the same name, can the new one just be renamed and so we can have both versions on our machine?  I was worried that what if the app writes back data to the /Applications/Xcode folder, then the GM version can write unexpected data for the 4.4.1 version.  And will it work with other software, such as Xcode 3.2, Xcode 3.3, or even different versions of Microsoft Office and Adobe Photoshop? I'm trying to write a small script to change the current directory to my project directory:  #!/bin/bash cd /home/tree/projects/java   I saved this file as proj, added execute permission with chmod, and copied it to /usr/bin. When I call it by: proj, it does nothing. What am I doing wrong? I have Ubuntu on my laptop. Now I want install Windows 7 in a dual-boot. How can I do this? I can't lose my Ubuntu files, and I'm afraid that I might break . Go  for UEFI only! What is the best book to learn probability? Question is quite straight... I'm not very good in this subject but need to understand at a good level. I'm having the same problem as it was questioned   I can't get throught the step where I need to show that $\nabla_{E_i}E_j (p)=0$. It only leads to $$ \nabla_{E_i}E_j(p)=\sum_{lk}^n a_{il}(0)\dfrac{\partial b_jk}{\partial x_l}(0)\partial x_k(p) $$ which I can't show that equals zero.  On the linked question, there is also the indication that $\nabla_{E_i}E_j (E_k)=\Gamma^k_{ij}$. This could lead that $\nabla_{E_i}E_j (E_k)(p)=\Gamma^k_{ij}(p)=0$, but $\nabla_{E_i}E_j (E_k)(p)$ is not equal to $\nabla_{E_i}E_j (p)$ which is the one I need.  Can someone help me? How do I paste into the Windows CMD prompt by using only the keyboard? My current technique is to right-click in the command prompt and then click paste.  This bugs me - is there a better way? Subsample of a random sample: random sample? Let's say you have a large random sample of soccer players in Europe but you are only interested in what happens in Spain. Could you reduce your sample to players in Spain and still call it a random sample (but of a different population)? If not, how would you call that subsample and which specific precautions should you take to be able to make inferences on the population of spanish soccer players?  My feeling is that using that subsample would be fine as long as it is large enough, but maybe I am missing something. The whole multi-continent aspect of A Song of Ice and Fire seems to be getting out of hand. Do the other continents suffer those long winters?  Can the Others harm the other continents?  In The Lord of the Rings there were other realms than Middle-earth, but Middle-earth was still all of humanity and dwarf population and hobbits.  Sure there are stories like Romeo and Juliet where the only thing that matters is whether those 2 are going have a chance to love.  But in these fantasy / sci-fi stories there's usually danger of world domination by evil.  It's not usually just one continent is going to be a terrible (or impossible) place to live but other civilizations will flourish. Is the universe really "fine-tuned for life"? I understand what is meant when we say , but I've seen it claimed it's is fine tuned "for life". Is it?  When I look at known or even speculated life in our universe, I see life clinging to a tiny crumbs separated by vast voids. Our life needs baryonic matter, only 5% of the universe. Its density is $10^{-30}  g/cm^3$, but it clumps together leaving vast voids between the clumps. 99% is in stars and black holes and nebula utterly inhospitable to known life.  That leaves the parts "fine tuned for life" to be 0.05% of the universe. The planets, asteroids, and comets seem like just debris separated by  than the life-sustaining clumps preventing life from spreading.  Even that seems to be used very inefficiently. Life requires the energy of a star, but it's spewed out in all directions. We only receive a tiny fraction of it. Similarly, life requires heavier elements created in supernova, but these are also spewed out in all directions. And it took billions of years to develop a being capable of asking "is the universe fine tuned for life?"  It seems like we live on the crumbs of creation warmed by a rounding error of the heat from our star. Taking this view, the universe appears extremely inhospitable to life. It could be a lot better tuned.  Is it that the universe is fine-tuned for life? Or is it that the universe is so large and life requires such an infinitesimal fraction of the universe that it's a near guarantee were we to roll the dice again that some crumb, maybe not even baryonic matter, could develop something complex enough to ask "why is the universe fine tuned for life"? Am I just restating the weak anthropic principle?  I understand this is straying into philosophy. If that's off topic, are my  physical assumptions correct? The keyboard on my laptop seems to be typing by itself:   It sometimes types characters like 134, whether by itself or when I hit certain keys. Repeating characters may appear unexpectedly. The system volume may change by itself, or windows like the Print dialog or Web browser may appear.   This can happen without any input or as I type, and may occur more often when certain keys are pressed. Sometimes, the keyboard fails to respond altogether. This is happening regardless of the software involved.  Is there a ghost in my keyboard—is my keyboard broken?  A sample of text from the keyboard might look like this (normal QWERTY...ASDF...ZXC... sequence is expected):   QWERTYUIOPASDF)(G@*HKLZXCVBN QWERTYIOPASDFGL!#ZXCVB13 QWERTYUIOPASDFGHJKLZXCVB!#N qwertyu41iopasdf19g13h28j113k4113zxcvb4n qwerty4u1iopasdf0g7h1jklzxcvb13m qwert13uuuuuuuuuuuuuuuiopasdf87091134ghhhhhhhhhhhhhhhhhhhhhhh13jk13zxcvb14      This question comes up often and the answers are usually the same. This post is meant to provide a definitive, canonical answer for this problem. Feel free to edit the answer to add additional details. How to run updmap-sys after installing cm-super? My original question was:   The answer that seems suitable to my cause is to install cm-super. I did that (using package manager [winxp 32 bit, MikTex installation 2.9 recently updated]). But still the command  \usepackage{cm-super}    yields an error.  User H Cavendish suggested to run updmap-sys, but I am not sure about how to do that on WinXP.   2011 November 04 edit: I made it sure that I have installed 'cm-super' - but still get the same error:   I have also tried updating the file name databases - but no avail.