C++ School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become a C++ Expert!

Join 309,258 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 2,485 people online right now. Registration is fast and FREE... Join Now!




Object Oriented Programming (oop) Tutorial

2 Pages V  1 2 >  
Reply to this topicStart new topic

> Object Oriented Programming (oop) Tutorial, Explains the basics of OOP. [Part-I]

Rating  3
born2c0de
Group Icon



post 21 Dec, 2004 - 02:02 AM
Post #1


This Tutorial teaches you Object Oriented Programming from scratch. It is supposed to teach Inheritance as well but it is incomplete as of now. But the tutorial teaches you so many other things before you need to know Inheritance that by the time you finish reading it, the other half will be complete.

-Sanchit
Go to the top of the page
+Quote Post


Register to Make This Ad Go Away!

born2c0de
Group Icon



post 13 Jan, 2005 - 08:54 AM
Post #2
I decided to make this Tutorial Complete in itself. Hence I shall name it OOP Tutorial in C++ PART 1.
PART 2 will contain Inheritance and a few advanced concepts of OOP.
Here's the PART-1 Version of the Tutorial.


Attached File(s)
Attached File  oop.txt ( 38.85k ) Number of downloads: 6114
Go to the top of the page
+Quote Post

Vextor
Group Icon



post 13 Nov, 2005 - 02:32 AM
Post #3
I know it's been some time since you posted this tutorial but I wanted to put my two cents in. This is really great and keep up the good work. It's given me everything I need to get myself back on track with where I had left off in C++ a while back. With this and a few other tutorials i've alaready learned a ton. Thanks!
Go to the top of the page
+Quote Post

born2c0de
Group Icon



post 17 Jan, 2006 - 06:04 AM
Post #4
I know it's been a long time since you posted before me [i just had to put in the pun wink2.gif ]
Sorry for late reply...looks like I should keep an eye on the Tutorials Section too.
Thanks for your appreciation...I makes me write more and more.
Currently I'm writing a tutorial on Recursion...It's going to be real exhaustive and informative.
I hope I'll be able to finish that soon because as I'm writing it, I feel its the best one so far.

Thanks.
Go to the top of the page
+Quote Post

Jessehk
Group Icon



post 17 Jan, 2006 - 02:10 PM
Post #5
I was under the impression that class methods should not be declared inline unless it was a template class.

Though I could be wrong...

Other than that, great tutorial. smile.gif
Go to the top of the page
+Quote Post

born2c0de
Group Icon



post 15 Mar, 2006 - 11:48 PM
Post #6
QUOTE(Jessehk @ 18 Jan, 2006 - 02:32 AM)
I was under the impression that class methods should not be declared inline unless it was a template class.

Though I could be wrong...

Other than that, great tutorial. smile.gif

no...just a matter of convention and choice...some people stick to that convention...
Go to the top of the page
+Quote Post

shikha
*



post 25 May, 2006 - 01:56 AM
Post #7
while using float values ...... we write 0.2f,6f........etc;
wat does ut signify?????
Go to the top of the page
+Quote Post

born2c0de
Group Icon



post 25 May, 2006 - 09:08 PM
Post #8
the 'f' suffix is just a printf Conversion-type character.
Any number that's suffixed with an 'f' just shows that its expected type is a floating point.

Here are the other Conversion-type characters.

QUOTE

Type Char Expected Input Format of output

d Integer signed decimal integer
i Integer signed decimal integer
o Integer unsigned octal integer
u Integer unsigned decimal integer
x Integer unsigned hexadecimal int (with a, b, c, d, e, f)
X Integer unsigned hexadecimal int (with A, B, C, D, E, F)
f Floating point signed value of the form [-]dddd.dddd.

e Floating point signed value of the form [-]d.dddd or e
[+/-]ddd
g Floating point signed value in either e or f form, based on given value and precision. Trailing zeros and the decimal point are printed if necessary.
E Floating point Same as e; with E for exponent.
G Floating point Same as g; with E for exponent if e format used

Characters
c Character Single character
s String pointer Prints characters until a null-terminator is pressed or precision is reached
% None Prints the % character

Pointers
n Pointer to int Stores (in the location pointed to by the input argument) a count of the chars written so far.
p Pointer Prints the input argument as a pointer; format depends on which memory model was used. It will be either XXXX:YYYY or YYYY (offset only).

Source : Borland Help
Go to the top of the page
+Quote Post

shikha
*



post 25 May, 2006 - 10:14 PM
Post #9
thankuuuuu................................ biggrin.gif
Go to the top of the page
+Quote Post

ankesh_ec
*



post 9 Sep, 2006 - 10:32 PM
Post #10
QUOTE(born2c0de @ 21 Dec, 2004 - 03:02 AM) *

This Tutorial teaches you Object Oriented Programming from scratch. It is supposed to teach Inheritance as well but it is incomplete as of now. But the tutorial teaches you so many other things before you need to know Inheritance that by the time you finish reading it, the other half will be complete.

-Sanchit

this is nice tutorial
Go to the top of the page
+Quote Post

completesunny
*



post 12 Sep, 2006 - 01:51 PM
Post #11
QUOTE(born2c0de @ 21 Dec, 2004 - 03:02 AM) *

This Tutorial teaches you Object Oriented Programming from scratch. It is supposed to teach Inheritance as well but it is incomplete as of now. But the tutorial teaches you so many other things before you need to know Inheritance that by the time you finish reading it, the other half will be complete.

-Sanchit



where can i get the PART 2 of this .....????can u send as soon as possible
Go to the top of the page
+Quote Post

virendra
*



post 12 Sep, 2006 - 08:16 PM
Post #12
where is the second part still waiting for it
virendra rolleyes.gif
Go to the top of the page
+Quote Post

born2c0de
Group Icon



post 13 Sep, 2006 - 08:49 AM
Post #13
Thanks for appreciating my tutorial guys.

And more than that, thanks for reminding me that I have to write the second part of this tutorial. I'm really sorry I totally forgot that I had this pending.


I'll start working on it.

And just in case if somone is already familiar with Inheritance in C++, be sure to check out my Polymorphism Tutorial in the C++ Tutorials Section.

I've even included how the compiler implements polymorphism internally.

Will be back soon with Part-2.

Sorry to keep you guys waiting.

And once again, thanks for reminding me about the second part.
Go to the top of the page
+Quote Post

janotte
Group Icon



post 28 Sep, 2006 - 06:10 AM
Post #14
Very cool tutorial, thank you.

I am a little confused by the "void main()".

Shouldn't it be "int main()" for C++?

Not a big issue but good to get people off on the right foot. But not to take away from your great work in putting this together. Thank you again.

Reference
The C++ Standard requires that main() returns type int. A program which uses any other return type for main() is technically not Standard C++, although many compilers do not enforce this strictly.
http://en.wikipedia.org/wiki/C_plus_plus#Minimal_program
Go to the top of the page
+Quote Post

born2c0de
Group Icon



post 28 Sep, 2006 - 08:16 AM
Post #15
Yes, I completely agree with you.
Unfortunately at the time of writing this tutorial, I did not realize this. And by the time I did, I was too lazy to change all voids to ints.

Glad to hear that you enjoyed the tutorial.
smile.gif
Go to the top of the page
+Quote Post

Xing
Group Icon



post 16 Nov, 2006 - 07:24 AM
Post #16
Didn't read the whole tutorial just scanned it fast. One thing which immidietly struck me was about the size of integer.

sizeof integer or any other built-in type is implementation defined in C and C++. Standard has only specified their minimum sizes

CODE

Base type    Minimum size (bits)    Minimum value (signed)    Maximum value (signed)    Maximum value (unsigned)
char            8                     -127                    127                       255
short           16                    -32,767                 32,767                    65,535
int             16                    -32,767                 32,767                    65,535
long            32                    -2,147,483,647          2,147,483,647             4,294,967,295

Go to the top of the page
+Quote Post

Oblivion
*



post 29 Nov, 2006 - 06:06 AM
Post #17
Thanks, this looks good. smile.gif
Go to the top of the page
+Quote Post

lapastica
*



post 9 Dec, 2006 - 09:01 AM
Post #18
great tutorial..thx
Go to the top of the page
+Quote Post

zorro68
*



post 15 Jan, 2007 - 01:22 PM
Post #19
I'm trying to know how works OOP and i think this tutorial is very good. But i can see you have some math mistakes in this tutorial, we see:

When you multiply two complex number, you say:
imag=(a.real * b.imag) - (a.imag * b.real);
and is:
imag=(a.real * b.imag) + (a.imag * b.real);

And when you divide complex numbers, you say:
float div = (....) + ( ....)
and is:
float div = (....) - ( ....)

So the output change:
...
Real=-5.47
Imaginary=7.92
...

and is:
...
Real=-9.24
Imaginary=11.88
...

You must change this in some functions when multiply and divide complex number.

I'm waiting for the next tutorial...

PD: Sorry for my bad english.

This post has been edited by zorro68: 15 Jan, 2007 - 01:26 PM
Go to the top of the page
+Quote Post

born2c0de
Group Icon



post 16 Jan, 2007 - 06:39 AM
Post #20
Thanks for correcting the errors
smile.gif
Go to the top of the page
+Quote Post


2 Pages V  1 2 >
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 


Lo-Fi Version Time is now: 11/26/09 09:58AM

Live C++ Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month