Programming With C and C++: in Internshala
Programming With C and C++: in Internshala
in Internshala
Name- Syed Mohd Areeb
Registration no- 11702322
INTRODUCTION
OF
C
C is a general-purpose high level language that was originally developed by Dennis
Ritchie for the Unix operating system. It was first implemented on the Digital
Eqquipment Corporation PDP-11 computer in 1972.
The Unix operating system and virtually all Unix applications are written in the C
language. C has now become a widely used professional language for various reasons.
Easy to learn
Structured language
It produces efficient programs.
It can handle low-level activities.
It can be compiled on a variety of computers.
Simple C Program
# include <stdio.h>
int main(void) {
printf(“Hello World\n”);
return 0;
INTRODUCTION
OF
C++
class Abc
{
int x;
void display()
{
// some statement
}
};
int main()
{
Abc obj;
// Object of class Abc created
}
.
INHERITANCE
The mechanism of deriving a new class from an old class is called inheritance
or derivation. The old class is known as base class while new class is known as
derived class or sub class. The inheritance is the most powerful features of
OOP
TYPES OF INHERITENCE
1) Public Inheritance
This is the most used inheritance mode. In this the protected member of super
class becomes protected members of sub class and public becomes public.
class Subclass : public Superclass
2) Private Inheritance
In private mode, the protected and public members of super class become private
members of derived class.
class Subclass : Superclass // By default its private inheritance
3) Protected Inheritance
In protected mode, the public and protected members of Super class becomes
protected members of Sub class.
class subclass : protected Superclass
POLYMORPHISM
Polymorphism is a Greek term which means ability to take more than one form. For example, + is
used to make sum of two numbers as well as it is used to combine two strings.
Or
It is done by the method Function overriding.
class Base
{
public: void show()
{
cout << "Base class";
}
};
class Derived:public Base
{
public: void show()
{
cout << "Derived Class";
}
}
PROJECT ON C
QUIZ GAME