By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,423 Members | 1,294 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,423 IT Pros & Developers. It's quick & easy.

DESPARATE HELP NEEDED WITH C#

P: n/a
I took a C# class as an elective and received an incomplete in it and
am desparate for help. I have two assignments left (arrays and
inheritance) and would gladly pay anyone that can assist me with
this.

I want you to know that I'm a 41 year old mother of three boys (ages
9, 7, and 2) and have done my very best to muddle through this
course. Sadly, my old brain is not equipped to handle it. LOL

Chrissy

Jan 22 '07 #1
Share this Question
Share on Google+
9 Replies


P: n/a
"Chrissy" <ce*****@yahoo.comwrote in message
news:11**********************@38g2000cwa.googlegro ups.com...
>I took a C# class as an elective and received an incomplete in it and
am desparate for help. I have two assignments left (arrays and
inheritance) and would gladly pay anyone that can assist me with
this.
Google and the MSDN Library will probably be your best bet for general
information.

If you have any specific questions, post them here with examples of the code
which is troubling you.
I want you to know that I'm a 41 year old mother of three boys (ages
9, 7, and 2) and have done my very best to muddle through this
course. Sadly, my old brain is not equipped to handle it. LOL
Well, I'm older than you, if that makes you feel any better... :-)
Jan 22 '07 #2

P: n/a
An ARRAY is a vertical collection of values.
Think of an ARRAY as a text file that holds one value on each line.
If I had a text file of integers, (one integer on each line) and I wanted
to know the value on the fouth line, I would go to the forth line and read
the value.
Only in an ARRAY we call the lines elements. Also ARRAYS are zero based.
So you have to do a quick step in your head when you are figuring what
element (line)
you need to access.
When you create an ARRAY, at some point you have to declare how many
elements you want in it.
something like
int[] intArray = new int[100]; //this would have 100 elements 0 thru 99
MessageBox.Show(intArray[3] ); //this would show the value in the forth
element. 0, 1, 2, 3
One of the benefits in using an ARRAY is that you can LOOP thru all the
values in an
ARRAY very quickly. I have kept this very short and simple to give you an
abstract view, but
you should do some searches on google.

gi***@ewcnetworks.com

"Chrissy" <ce*****@yahoo.comwrote in message
news:11**********************@38g2000cwa.googlegro ups.com...
>I took a C# class as an elective and received an incomplete in it and
am desparate for help. I have two assignments left (arrays and
inheritance) and would gladly pay anyone that can assist me with
this.

I want you to know that I'm a 41 year old mother of three boys (ages
9, 7, and 2) and have done my very best to muddle through this
course. Sadly, my old brain is not equipped to handle it. LOL

Chrissy

Jan 22 '07 #3

P: n/a
On 21 Jan 2007 16:40:58 -0800, "Chrissy" <ce*****@yahoo.comwrote:
>I took a C# class as an elective and received an incomplete in it and
am desparate for help. I have two assignments left (arrays and
inheritance) and would gladly pay anyone that can assist me with
this.

I want you to know that I'm a 41 year old mother of three boys (ages
9, 7, and 2) and have done my very best to muddle through this
course. Sadly, my old brain is not equipped to handle it. LOL

Chrissy
Inheritance: assume that you want to develop a graphics software.

Before you write some code (being it in C# or C++ or other language),
you should have an idea of the objects ("classes") that will be part
of your software system.

For a graphics software, the idea of "Shape" object pops up in mind.
So, you could define a class called Shape, to represents a geometrical
shape.

The shape would have some "attributes" (or "properties", in C#
terminology), like its background colour, or the colour of its
contour, its position in space, etc.

The shape would also have some "operations" (or "instance methods" in
C# terminology) like drawing itself, or translate, or rotate.

So, we end up with defining a class something like this:

+-----------------+
| Shape | <-- Class name
+-----------------+
| Position | <-- Attributes (Properties)
| BackgroundColor |
| ContourColor |
+-----------------+
| Draw | <-- Methods
| Translate |
| Rotate |
+-----------------+

Then, you will have different kinds of objects, like a triangle, a
circle, a square, an ellipse, a regular poloygon, etc.
You would define a class for each of them (so you will end up having
classes: Circle, Square, RegularPolygon, etc.)

All these classes will *inherit* from the shape class, because all
these classes ARE shapes. This means that all these classes will have
Position, BackgroundColor, etc. properties, and all will have Draw,
Translate, Rotate methods.

However, each one of these classes will have a different
implementation for e.g. the Draw method: the Circle class
implementation of the Draw() method will draw a circle; the
Square.Draw() method will draw a square, etc.

Moreover, each of this classes could add *more* information than the
information present in the *base* class (i.e. the Shape class).

e.g. a Circle class could have a Radius property (having a radius is a
concept typical of circles, but not of squares or polygons).

So:

- You have a *base* class (Shape), which has some properties and
methods

- You have some *derived* classes (Circle, Square, ...). They are
derived from the base class, or they *inherit* from the base class.
This means that the derived classes have all the properties and
methods of the base class, plus the derived classes may add some more
methods and properties (like Circle class, it has the Radius property
that the Shape class has not).

Note that inheritance in C# is available for *classes* (not for
*structures*).

Moreover, you should know the existance of two fundamental keywords
for inheritance mechanics: the "virtual" keyword and the "override"
keyword.

In the above example, the Shape methods like Draw, Translate, etc.
will be defined as *virtual*. It means that derived classes could
override them. In derived classes implementation you will use the
"override" keyword, to tell the compiler that you are providing the
customized implementation of that method.

Another example is the object hierarchy in C#.

C# objects are derived from the "root" System.Object class.
System.Object has a method called ToString(), which purpose is to give
a string representation of the object content. Obviously, each derived
class will provide its custom implementation of ToString() method.

In the System.Object the ToString() method would be defined as:

public virtual string ToString()

This means that everyone can access the method (public) and that the
method can be overridden in derived classes (virtual).

When you define a custom class, this class is derived from
System.Object, so this class could redefine the ToString() method.
And you will have:

// In your class, e.g. in a Circle class:

public override string ToString()
{
return String.Format(
"I'm a circle with radius = {0}", radius );
}

As other have suggested, you could search more information on Google
and C# tutorials (I'm sure that there will be a lot of!).

As for your age, I think it is not absolutely a problem :)

I'm sure that there are some outstanding people also older than you
(some of my programming "heros" :) - I think they work in Microsoft -
like Don Box or other "progamming rock-stars" like the software
engineers behind Windows NT kernel operating system like Dave Weise,
all these outstanding people I think are older than you - or are as
old as you - and produce great software).

And Enrico Fermi was 54 when he wrote a great physics article about
non-linear systems.

etc.

Best
MrAsm
Jan 22 '07 #4

P: n/a
Hello Chrissy,

Arrays [1] can be complex to understand. Think of an array as a group of
little boxes laid next to one another to form a line of little boxes. Boxes
are little containers that can contain stuff like data. Each box has a
number on it. This number is called an indice (an index) and is analagous to
a house number for all the little boxes called houses on the street you may
live on. In C# the indice is written arrayName[x] where x is an integer and
the count starts with 0 (zero). I think the article I referred to will be
helpful.

As for inheritence, you got three little instances of inheritence right in
your household. Each boy inherited something from his parents; eye color,
hair color, and other "properties" right? Some thing was inherited but not
neccessarily all things were inherited. The same is true when inheriting
properties of a class. In C# the class is the "parent" and an instance of a
class is similar to one of the boys that has inherited properties from its
parent. Those inherited properties can be accessed to get or set the
property values. Its much easier to change a boy's eye color property in C#
than it is in real life and don't get me started on inherited temperment as
I've heard "You're just like your father" too many times! ;-)

I hope these analogies help. Hang in there and don't quit. It takes a long
time for most of us to really learn OOP. I have a feeling you can and will
do it...

<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://clintongallagher.metromilwaukee.com/
MAP http://wikimapia.org/#y=43038073&x=-...8&z=17&l=0&m=h

[1] http://www.devhood.com/tutorials/tut...utorial_id=612

"Chrissy" <ce*****@yahoo.comwrote in message
news:11**********************@38g2000cwa.googlegro ups.com...
>I took a C# class as an elective and received an incomplete in it and
am desparate for help. I have two assignments left (arrays and
inheritance) and would gladly pay anyone that can assist me with
this.

I want you to know that I'm a 41 year old mother of three boys (ages
9, 7, and 2) and have done my very best to muddle through this
course. Sadly, my old brain is not equipped to handle it. LOL

Chrissy

Jan 22 '07 #5

P: n/a
"Mark Rae" <ma**@markNOSPAMrae.coma écrit dans le message de news:
uA**************@TK2MSFTNGP05.phx.gbl...

| Google and the MSDN Library will probably be your best bet for general
| information.

Google also shows this identical message posted 22nd Jan with no
acknowledement of any replies.

Joanna

--
Joanna Carter [TeamB]
Consultant Software Engineer
Feb 16 '07 #6

P: n/a
"Joanna Carter [TeamB]" <jo****@not.for.spamwrote in message
news:uY*************@TK2MSFTNGP06.phx.gbl...
| Google and the MSDN Library will probably be your best bet for general
| information.

Google also shows this identical message posted 22nd Jan with no
acknowledement of any replies.
??? And how many hits do you get if you search for "C#" array or "C#"
inheritance ???
Feb 16 '07 #7

P: n/a
"Mark Rae" <ma**@markNOSPAMrae.coma écrit dans le message de news:
OF**************@TK2MSFTNGP04.phx.gbl...

| ??? And how many hits do you get if you search for "C#" array or "C#"
| inheritance ???

Lots more than if you Google for C# + elective + mother

Joanna

--
Joanna Carter [TeamB]
Consultant Software Engineer
Feb 16 '07 #8

P: n/a
Good point. The key to success using Google is in using the right search
terms. This is also true of the MSDN Library, but it is much more of a
challenge! ;-)

--
HTH,

Kevin Spencer
Microsoft MVP
Software Composer
http://unclechutney.blogspot.com

The shortest distance between 2 points is a curve.

"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:OF**************@TK2MSFTNGP04.phx.gbl...
"Joanna Carter [TeamB]" <jo****@not.for.spamwrote in message
news:uY*************@TK2MSFTNGP06.phx.gbl...
>| Google and the MSDN Library will probably be your best bet for general
| information.

Google also shows this identical message posted 22nd Jan with no
acknowledement of any replies.

??? And how many hits do you get if you search for "C#" array or "C#"
inheritance ???

Feb 16 '07 #9

P: n/a
"Joanna Carter [TeamB]" <jo****@not.for.spama écrit dans le message de
news: uX**************@TK2MSFTNGP06.phx.gbl...

I have just realised that the post to which I just responded was the first
post in the thread which, somehow, popped into Outlook Express as if it were
a new thread. I didn't notice the month old date.

Don't you just love MS software :-)

Joanna

--
Joanna Carter [TeamB]
Consultant Software Engineer
Feb 16 '07 #10

This discussion thread is closed

Replies have been disabled for this discussion.