First starting with c++


prerequisite for this is c some guys get books of deep c i hope

This tutor designed for noobs so anybody who knows c++ well just keep quiet and dont show off ur ...... etccc

i go slowly one chapter per day starting some theories it may quite boring pls adopt that

if u wont understand some concepts later we go by examples u can understand everything .....


after the session overs any doubts just leave ur questions here...

about compiler its ur wish ....

i wont help the compiler configuration and all ..... download it via software zones...

That's it

lets start c++

A little history

The C++ programming language was initially created by Bjarne Stroustrup, as a "better C". C++ was an attempt to extend and (to some extent) change the C programming language to overcome some problems. C++ standardized in 1998.

Should I Learn C First?

The question arises in ur mind .For my tutorial u should have learnt atleast upto for loop,functions. Because C++ is a superset of C. I have one good book for c named deep c …leave mail id in my scrap I will send through mail mention everything properly.

Comparison c++ with other languages

After learnin this tutorial …. Finally I will tell.

skipping

variables, conditional statements, loops ,operators, functions. These r similar in C.

 

What Is a Program?



The word program is used in two ways: to describe individual instructions, or source code,created by the programmer ex. Hello.cpp and to describe an entire piece of executable software.ex.hello.exe

Move to compiler

-----------------Top 6 c-c++ compiler-------------------



1. DevC++
2. MinGW Studio
3. GNU Emacs and XEmacs
4. Microsoft Visual C++ 2005
5. Eclipse for C++ with CDT
6. Code::Blocks

Compiler types


16-bit compiler ex: familiar one turbo c++
32-bit compiler ex: Microsoft Visual C++ 2005
64-bit compiler
Wat makes difference
In 16 bit compiler the int size is 2 bytes
For 32 bit int size is 4 bytes
Check out using sizeof() operator

Now compiling phases


First u will create a code using any editor even our notepad is a editor.
Most of them have turbo c++ but i recommend move to mingw studio or Microsoft
Turbo c++ also u can practice


code:


#include
int main()
{
std::cout << "Hello world!" << std::endl;
return 0;
}


And save it as hello.cpp

-->>Note: wait look the code once .. std ve u heard about it …. Note it that is namespace
>> When u compile ur code converted into hello.obj or hello.o

>>Before compilation, a special program called the preprocessor scans the source code and preforms simple substitution.

>>The preprocessor examines all lines beginning with # , performs the corresponding actions and macro replacements, and produces a preprocessed version of your program with the file name suffix .i. The .i file is created in a directory used to store temporary files.
>>Preprocessor is separate topic will be discussed elaborately later.

>>Compiler ensures that the code is valid(syntax checking like that) and will sequence into an executable program(sequence arrangement for execution). Under some compilers, you may get messages or warnings with your program
alt

Wat this hello.obj or hello.o contains?


The .o or .obj contains the binary version of the source code which is not directly executable.


>>The final form hello.exe
Here we have one component named linker which combines the object codes into one complete program by integrating libraries(header files) and the code(program which contains 2 or more source codes in separate files ) and producing an executable program.

>>>>>Note: reversing using c++ object code to exact source code is almost impossible to do.If u get many tools in net about reversing but 98% will not give the exact source.Maybe if u wanna knw more about reversing ask some forms and do and report here I got no practice in that .. I too will learn

Wat is class and object?


Ex : Apple is a fruit
Class : fruit
Object :apple

(classes)
• Putting behaviors (functions) and attributes (data) together.
• A class does not exist in the memory of computer during program execution.
(Object)
• An instance of a class. There can be more than one instance for a class.


Frm above example
Consider fruit
Lets check out fruits attributes

(programmatic view inside C++ program looks like this…)

Fruit color - string strFruitColor;
Fruit name - string strFruitName;



Lets check out fruits behaviors
Fruit weight
int weight(string strFruitName)
{
// some code to find weight
return intFruitWeight;
}

code:

class Fruit {
// fields
string strFruitColor;
string strFruitName;

// a function
int weight(string strFruitName)
{
// some code to find weight
return intFruitWeight;
}
}

move to encapsulation, polymorphism,inheritance

What is encapsulation? What’s its uses?


In general the definition is hiding the non-essential characteristics to others.
ex:
->If I want to show the gifts I have received from my girlfriend I'll show otherwise I'll hide them If I don’t wish to.
-> in simple means just hiding the some data in one class not sharing to other class … ex will be given when we move to access specifier topic.

()()Uses:()()
Just hiding our data by covering up (encapsulating) from others…

What is polymorphism?


->It means multiple possible states for a single property.
->polymorphism (Poly-many, orphism-form).
->Consider u ve one elder brother he is lecturer of ur class
U will act bro in ur home and student to ur bro in college… u r taking some forms (now its clear)
->The concept of polymorphism applies to both data types and functions.

()()Purpose:()()
Need to override or overload to change the function behaviors according to the application.

what is Inheritance?


even child knows inheritance
->Acquiring some of the common qualities from parents (for instance eyes like mother, a mole like father etc..) is called inheritance.
->In oop it can also be defined as acquiring some property from others is called inheritance. Based on the sources it differs.

()()Uses:()()
->Inheritance is intended to help reuse existing code with little or no modification.
->The new classes, known as derived classes, inherit attributes and behavior of the pre-existing classes, which are referred to as base classes.
all install compilers and learn c

the best book for c is deep c by ganesan have it

i will continue tomorrow
cheers !!!

Like it on Facebook, Tweet it or share this article on other bookmarking websites.

No comments