Professional Documents
Culture Documents
Definition of CPP
Definition of CPP
Definition of CPP
Class: - class is blue print of program, in cpp class have three type of specifier
1. Public
2. Private
3. Protected
Class attributes: - a variable which is declare inside the classes that’s variable is
known as variable of class, data member of class and attributes
Class Behaviors: - a function which is define declare and call inside the class
function is known as class behaviors, method ,data member function of class and
function of class.
Class
Specifiers:-
Attributes
Method s
History of cpp: - introducer: - Bjarne strostrup
In 1979 Bjarne strostrup was add class in c and make
language give the name of language is c with classes at
“bell lab AT&T’s California state united states of
America” after 4 year update their name was change at
1983 “bell lab…..” and give definition of cpp , cpp is a
extend form of c.
How to make class inside the program: - in cpp class is a
user define data only that’s why their declare is outside of
main function in other words we can also say class have
global type deceleration.
Class is declare with the class keyword in cpp.
Syntax of class=>
Class keyword class name
Specifier:
Attributes
Function
Specifier:
Attributes
Attributes
Function
Function
};
Object: - you know class is blue print and if user want
to be blue print convert into real-entity user’s need object.
One class have converts in form of real entity with the
help of one or more then object
In another words we can also say that if user want
To convert blue print into real entity than users need
at least one object which is convert blue print into real
entity. Object help to call attributes and method which is
present inside the class.
#include<iostream>
using namespace std;
class first
{
public:
string name;
int age;
int method()
{
cout<<"Wellcome into myn first methof cpp \n";
cout<<"enter the name of student :- ";
cin>>name;
cout<<"Enter the age of user :- ";
cin>>age;
cout<<"The name of student :- "<<name;
cout<<"The age of student:- "<<age;
}
};
int main()
{
first object;
object.method();
}
HOME WORK
Why we use header file?
Answer :-
_____________________________________________________________
_____________________________________________________________
_____________________________________________________________
_____________________________________________________________
_____________________________________________________________
_____________________________________________________________
_____________________________________________________________
_____________________________________________________________
_____________________________________________________________
_____________________________________________________________
Learn introduction of cpp
What is class and note on specifier?
What is attributes?
What is method inside the class?