CSC/ECE 517 Fall 2012/ch1 1w23 as: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 11: Line 11:


==Issues of Multiple Inheritance==
==Issues of Multiple Inheritance==
''Headings'' organize your writing
into sections. The wiki software
can automatically generate a
[[Help:Section|table of contents]]
from them. Start with 2 'equals'
("==") characters.
Let us consider a real world example of representing players of Cricket using classes and instances. The players of Cricket are instances of class Cricketer. Classes Bowler and Batsman inherit  Cricketer’s state and behavior. All rounders inherit states and behaviors of Batsman, Bowler and subsequently from the Cricketer through Batsman and Bowler classes. Let us explore the issues of multiple inheritance in reference to this context.
===Subsection===
Using more 'equals' characters
creates a subsection.
====A smaller subsection====
Don't skip levels, like from two
("==") to four ("====") 'equals'
characters.
;A defined term: A semicolon at the
start of a line is a way of making
a definition where the word being
defined appears in bold.
The definition itself follows the
colon and is not rendered bold by
default. It is not a heading and
does not appear in the table of
contents.
===Lists===
* ''Unordered [[Help:List|list]]s'' are easy to do:
** Start every line with a star.
*** More stars indicate a deeper level.
**: Previous item continues.
** A new line
* in a list
marks the end of the list.
* Of course you can start again.
# ''Numbered lists'' are:
## Very organized
## Easy to follow
#: Previous item continues
A new line marks the end of the list.
# New numbering starts with 1.
==Format==
===Text formatting===
{| class="wikitable"
|- valign="top"
! Description
! What you type
! What it looks like
|- id="emph" valign="top"
|
''Italics'', '''bold''', {{Smallcaps|small capital letters}}.
|
<pre>To ''italicize text'', just put
2 apostrophes on each side.
3 apostrophes will '''bold the text'''
5 apostrophes for '''''bold italics'''''
For text as {{Smallcaps|small caps}},
that uses a [[Help:Template|template]].
</pre>
|
To ''italicize text'', just put
2 apostrophes on each side.
3 apostrophes will '''bold the text'''
5 apostrophes for '''''bold italics'''''
For text as {{Smallcaps|small caps}},
that uses a [[Help:Template|template]].
|- valign=top
|
Small chunks of source code within a line of normal text.
Code is displayed in a monospace font.
|
<pre><nowiki>function <code>int m2()</code> is nice</nowiki></pre>
|
function <code>int m2()</code> is nice
|- valign="top"
|
[[mw:Extension:SyntaxHighlight GeSHi|Syntax highlighting]] for source code.
Computer code has colored text and more stringent formatting.
For example, to define a function: <code>int m2()</code>, with highlights.
|
<pre><nowiki><syntaxhighlight lang="cpp">
#include <iostream>
int m2 (int ax, char *p_ax) {
  std::cout <<"Hello World!";
  return 0;
}</syntaxhighlight></nowiki></pre>
|
<syntaxhighlight lang="cpp">
#include <iostream>
int m2 (int ax, char *p_ax) {
  std::cout <<"Hello World!";
  return 0;
}</syntaxhighlight>
|- valign=top
|
<small>Small text</small>.
|
<pre><nowiki>Use <small>small text</small> if needed.
A span tag can set text font-size as
being <span style="font-size:87%">87%
of prior size</span>, to match an
image caption.</nowiki></pre>
|
Use <small>small text</small> if needed.
A span tag can set text font-size as
being <span style="font-size:87%">87%
of prior size</span>, to match an
image caption.
|- valign="top"
|
<big>Big text</big>.
|
<pre><nowiki>
Better not use <big>big text</big>,
unless <small> it's <big>within</big>
small</small> text.
</nowiki></pre>
|
Better not use <big>big text</big>,
unless <small> it's <big>within</big>
small</small> text.
|-
|
You can include a '''non-breaking space''' (sometimes called '''non-printing character''') where you require two words to always appear together on the same line, such as ''Mr.&nbsp;Smith'' or ''400&nbsp;km/h'', using '''<code>&amp;nbsp;</code>''' in place of a regular space between the two "words" that need to behave as a single word (never be separated on different lines).
|
<pre>Mr.&amp;nbsp;Smith or 400&amp;nbsp;km/h.</pre>
|
Mr.&nbsp;Smith or 400&nbsp;km/h.
|-
|
'''Extra spacing''' within text can best be achieved using the [[Template:Pad|pad]] template.
|
<pre><nowiki>Mary {{pad|4em}} had a little lamb.</nowiki></pre>
|
Mary {{pad|4em}} had a little lamb.
|-
|
'''Typewriter font'''.
(Also works beyond the end of a paragraph.)
|
<pre><nowiki><tt>arrow      &amp;rarr;</tt>
<tt>''italics'', '''bold'''</tt>
<tt><nowiki>[[link]]</nowiki>
New paragraph </tt>started here.</pre>
|
<tt>arrow      &rarr;</tt>
<tt>''italics'', '''bold'''</tt>
<tt>[[link]]
New paragraph </tt>started here.
|}
====Link to another wiki article====
* Internally, the first letter of the target page is automatically capitalized and spaces are represented as underscores (typing an underscore in the link has the same effect as typing a space, but is not recommended).
* Thus the link hereafter is to the Web address <code>en.wikipedia.org/wiki/Public_transport</code>, which is the Wikipedia article with the name "Public transport". See also [[Help:Link#Conversion to canonical form|Canonicalization]].
* [[Intentionally permanent red link|A red link]] is a page that doesn't exist yet; it can be created by clicking on the link.
* [[Help:Self link|A link to its own page]] will appear only as bold text.
{| class="wikitable"
! What you type
! What it looks like
|-
|
<code><nowiki>London has [[public transport]].</nowiki></code>
|
London has [[public transport]].
|-
|
<code><nowiki>Link to this own article: "[[Help:Wiki markup]]" will appear only as bold text.</nowiki></code>
|
Link to this own article: "[[Help:Wiki markup]]" will appear only as bold text.
|}

Revision as of 02:08, 12 September 2012

1w23: Multiple Inheritance and Mixins

Introduction

Multiple Inheritance

Multiple Inheritance is a technique of establishing hierarchical relationships within a set of classes, such that a single class can inherit  behaviors from multiple parent classes. Although it might seem useful, to include methods from multiple classes, the major issue with multiple inheritance is the ambiguity in referencing the parent class methods,  when more than one parent classes share a method with the same name.This ambiguity is predominant in cases where the inheritance hierarchy is more than one level deep, where the class in the lowermost level inherits from two classes, that have overridden the same method from their parent in different ways.Now the class in the lowermost level has two different implementations of its grand-parent’s method resulting in an ambiguous situation, which is otherwise called as the Deadly Diamond of Death problem.

A Real World Example

Issues of Multiple Inheritance