You are on page 1of 20

Weekly Session

Coding
Class - 2
03/11/21
Variables

1. A Variable is a name of the memory location. It is used to store data. Its


value can be changed, and it can be reused many times.
2. It is a way to represent memory location through symbol so that it can
be easily identified.
Example :
● int a
● float b
● a & b are variables
Conditions for defining Variables

1. A variable can have alphabets, digits, and underscore.


2. A variable can start with the alphabet, and underscore only. It can’t start
with a digit.
3. No whitespace is allowed within the variable name.
4. A Variable name must not be any reserved word or keyword, e.g., int,
float, etc
Local Variable

1. A Variable that is declared inside the function or block is called a local


variable.
2. It must be declared at the start of the block.

void function1(){

int x = 10; //local variable

}
Global Variable

1. A Variable that is declared outside the function or block is called a


global variable. Any function can change the value of the global
variable. It is available to all the functions.
2. It must be declared at the start of the block.

int value = 20;

void function){

int x = 10; }//local variable


Data types

A Data type specifies the type of data that a variable can store such as
integer, floating, character, etc.

Basic data type int, char, float, double

Derived datatype array, pointer, structure, union


if - else conditions

● The if-else statement in C is used to perform the operations based on


some specific condition. The operations specified in if block are
executed if and only if the given condition is true.
● There are following variants of if statement in C language:
● if Statement
● if-else statement
● if-else-if ladder
● Nested if
LOOPS

The looping can be defined as repeating the same process multiple


times until a specific condition satisfies. There are three types of loops
used

1. While loop
2. For loop
3. Do while loop
GUEST TALK

Ilakkiya Rajasekar
Company : Athena
health
Passed out year : 2021
OOPS
Object Oriented Programming

1. OOPs refers to Object-Oriented Programming. It is the programming


paradigm that is defined using objects.
2. Objects can be considered as real-world instances of entities like Class,
that have some characteristics and behaviours.
3. Object is nothing but instances of a class.
Need For OOPs

There are many reasons why OOPs is mostly preferred, but the most important
among them are:

1. OOPs helps users to understand the software easily, although they don’t
know the actual implementation.
2. With OOPs, the readability, understandability, and maintainability of the
code increase multi fold.
3. Even very big software can be easily written and managed easily using
OOPs
Some Examples of OOP
Languages
1. C++
2. Java
3. Java script
4. Python
5. PHP
CLASS
A Class can be understood as a template or a blueprint, which contains some
values, known as member data or member, and some set of rules, known as
behaviours or functions. So when an object is created, it automatically takes
the data and functions that are defined in the class.
Therefore the class is basically a template or blueprint for objects. Also one
can create as many objects as they want based on a class.
For example,
first, a car’s template is created. Then multiple units of car are created based
on that template.
OBJECT

An Object refers to the instance of the class, which contains


the instance of the members and behaviours defined in the
class template. In the real world, an object is an actual entity
to which a user interacts, whereas class is just the blueprint
for that object. So the objects consume space and have some
characteristic behaviour.

For example, a specific car.


Four Pillars of OOPS

1. Inheritance
2. · Encapsulation
3. · Polymorphism
4. Data Abstraction
INHERITANCE

The capability of a class to derive properties and characteristics from


another class is called Inheritance
Types of Inheritance
● Single
● Multiple
● Multi level
● Hierarchical
● Hybrid
ABSTRACTION

1. Data abstraction is one of the most essential and important


features of object-oriented programming in C++. Abstraction
means displaying only essential information and hiding the
details.
2. Data abstraction refers to providing only essential information
about the data to the outside world, hiding the background details
or implementation
POLYMORPHISM

1. The word Polymorphism means having many forms. In


simple words, we can define polymorphism as the ability of a
message to be displayed in more than one form.

Types

a. Compile time polymorphism


b. Runtime polymorphism
ENCAPSULATION

1. In normal terms, Encapsulation is defined as wrapping


up of data and information under a single unit.
2. In Object-Oriented Programming, Encapsulation is
defined as binding together the data and the functions
that manipulate them.
CONGRATULATIO
NS20% of the Weekly
Now you have completed
Sessions!!!

Keep Doing and Attend All the Classes.

Consistency is the key to programming.

You might also like