0% found this document useful (0 votes)
18 views

CPP

Cpp

Uploaded by

swapnil kayde
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

CPP

Cpp

Uploaded by

swapnil kayde
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

C++ Programming

Trainer : Rohan Paramane


Email: [email protected]

Sunbeam Infotech www.sunbeaminfo.com


Oops (Object Oriented Programming Concepts) with C++

• Introduction to Object Oriented Programming


• C++ Introduction
• Namespaces
• Functions
• Class and Object
• Exception Handling
• Memory management
• Inheritance
• Virtual Function

Sunbeam Infotech www.sunbeaminfo.com


Agenda

• Introduction & History


• Major and Minor Pillars of OOPs
• Data Types
• Structure in C and Cpp

Sunbeam Infotech www.sunbeaminfo.com


Limitations of C Programming

• C is said to be process oriented, structured programming language.


• When program becomes complex, understating and maintaining such programs is very difficult.
• Language don’t provide security for data.
• Using functions we can achieve code reusability, but reusability is limited. The programs are not
extendible.

Sunbeam Infotech www.sunbeaminfo.com


Classification of high level Languages

• Procedure Oriented Programming language( POP )


• ALGOL, FORTRAN, PASCAL, BASIC, C etc.
• "FORTRAN" is considered as first high level POP language.
• All POP languages follows "TOP Down" approach

• Object oriented programming languages( OOP )


• Simula, Smalltalk, C++, Java, C#, Python, Go
• "Simula" is considered as first high level OOP language.
• more than 2000 lang. are OO.
• All OOP languages follows "Bottom UP" approach

Sunbeam Infotech www.sunbeaminfo.com


Few Real Time Applications of C++

• Games
• GUI Based Application (Adobe)
• Database Software (MySQL Server)
• OS (Apple OS)
• Browser( Mozilla)
• Google Applications(Google File System and Chrome browser)
• Banking Applications
• Compilers
• Embedded Systems(smart watches, MP3 players, GPS systems)

Sunbeam Infotech www.sunbeaminfo.com


Characteristics of Language

1. It has own syntax


2. It has its own rule( semantics )
3. It contain tokens:
• Identifier
• Keyword
• Constant/literal
• Operator
• Seperator / punctuators
4. It contains built in features.
5. We use language to develop application( CUI, GUI, Library )

Sunbeam Infotech www.sunbeaminfo.com


History of C++

• OOPS is not a syntax.


• It is a process / programming methodology which is used to solve real world problems.

• Inventor of C++ is Bjarne Stroustrup.


• C++ is derived from C and simula.
• Its initial name was "C With Classes".
• It is developed in "AT&T Bell Lab" in 1979.
• It is developed on Unix Operating System.
• In 1983 ANSI renamed "C With Classes" to C++.
• C++ is objet oriented programming language

Sunbeam Infotech www.sunbeaminfo.com


OOPS(Object Oriented Programming Language)

• It is a programming methodology to organize complex program in to simple program in terms of


classes and object such methodology is called oops.
• It is a programming methodology to organized complex program into simple program by using concept
of abstraction , encapsulation , polymorphism and inheritance.
• Languages which support abstraction , encapsulation polymorphism and inheritance are called oop
language.

Sunbeam Infotech www.sunbeaminfo.com


Major pillars of oops
• Abstraction
• getting only essential things and hiding unnecessary details is called as abstraction.
• Abstraction always describe outer behavior of object.
• In console application when we give call to function in to the main function , it represents the abstraction
• Encapsulation
• binding of data and code together is called as encapsulation.
• Implementation of abstraction is called encapsulation.
• Encapsulation always describe inner behavior of object
• Function call is abstraction
• Function definition is encapsulation.
• Information hiding
• Data : unprocessed raw material is called as data.
• Process data is called as information.
• Hiding information from user is called information hiding.
• In c++ we used access Specifier to provide information hiding.
• Modularity
• Dividing programs into small modules for the purpose of simplicity is called modularity.
• Hierarchy (Inheritance [is-a] , Composition [has-a] , Aggregation[has-a], Dependancy)
• Hierarchy is ranking or ordering of abstractions.
• Main purpose of hierarchy is to achieve re-usability.

Sunbeam Infotech www.sunbeaminfo.com


Minor pillars of oops
• Polymorphism (Typing)
• One interface having multiple forms is called as polymorphism.
• Polymorphism have two types
1. Compile time polymorphism
when the call to the function resolved at compile time it is called as compile time polymorphism. And it is achieved
by using function overloading and operator overloading
2. Runtime polymorphism.
when the call to the function resolved at run time it is called as run time polymorphism. And it is
achieved by using function overriding.
• Compile time / Static polymorphism / Static binding / Early binding / Weak typing / False Polymorphism
• Run time / Dynamic polymorphism / Dynamic binding / Late binding / Strong typing / True polymorphism
• Concurrency
• The concurrency problem arises when multiple threads simultaneously access same object.
• You need to take care of object synchronization when concurrency is introduced in the system.
• Persistence
• It is property by which object maintains its state across time and space.
• It talks about concept of serialization and also about transferring object across network.

Sunbeam Infotech www.sunbeaminfo.com


Main Function

• main should be entry point function of C/C++


• Calling/invoking main function is responsibility of operating system.
• Hence it is also called as Callback function

Sunbeam Infotech www.sunbeaminfo.com


Data Types in C++

• It describes 3 things about variable / object


1. Memory : How much memory is required to store the data.
2. Nature : Which type of data memory can store
3. Operation : Which operations are allowed to perform on data stored inside memory.

- Fundamental Data Types (void, int,char,float,double)


-Derived Data Types ( Array, Function, Pointer, Union ,Structure)

Two more additional data types that c++ supports are


1. bool :- it can take true or false value. It takes one byte in memory.
2. wchar_t :- it can store 16 bit character. It takes 2 bytes in memory.

Sunbeam Infotech www.sunbeaminfo.com


Bool and wchar_t
• e.g: bool val=true;
• wchar_t: Wide Character. This should be avoided because its size is implementation defined and not
reliable.
• Wide char is similar to char data type, except that wide char take up twice the space and can take on much
larger values as a result. char can take 256 values which corresponds to entries in the ASCII table. On the
other hand, wide char can take on 65536 values which corresponds to UNICODE values which is a recent
international standard which allows for the encoding of characters for virtually all languages and commonly
used symbols.

• The type for character constants is char, the type for wide character is wchar_t.
• This data type occupies 2 or 4 bytes depending on the compiler being used.
• Mostly the wchar_t datatype is used when international languages like Japanese are used.
• This data type occupies 2 or 4 bytes depending on the compiler being used.
• L is the prefix for wide character literals and wide-character string literals which tells the compiler that that
the char or string is of type wide-char.
• w is prefixed in operations like scanning (wcin) or printing (wcout) while operating wide-char type.

Sunbeam Infotech www.sunbeaminfo.com


Thank You

Sunbeam Infotech www.sunbeaminfo.com

You might also like