SlideShare a Scribd company logo
1 of 50
Classes and Objects
By
Nilesh Dalvi
Lecturer, Patkar‐Varde College
Object oriented Programming
with C++
Class
• Class is a way to bind data and its associated 
functions together.
• It allows the data (and functions) to be hidden, if 
necessary, from external use.
• When defining a class, we creating a new abstract 
data type that can be treated like any other built‐
in data type.
• Class specification has two parts:
– Class declaration
– Class function definitions
• Class declaration describes the type and scope of 
its members.
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
Class
The general form of class declaration:
class class_name
{
private:
variable declaration;
function declaration;
public:
variable declaration;
function declaration;
};
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
Class
• Keyword class specifies, that what follows 
is an abstract data of type class_name.
• Body of class enclosed within braces and 
terminated by semicolon.
• Contains declaration of variables and 
functions, collectively called as class
members.
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
Class
• Keyword private and public are 
known as visibility labels.
• If both keyword are missing then, by 
default, all members are private .
• public member function can have access 
to private data members and private
functions.
• public members can be accessible from 
outside class.
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
Class
Fig. 1 Data hiding in classes
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
Class
A Simple class example:
class item
{
int number; //variable declaration
float cost; //private by default
public:
void getdata(int a, float b); //functions declaration
void putdata(void);
}; //ends with semicolon
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
Creating Objects
• Once a class has been declared, we can create variables of 
that type by using the class name.
• For Example: 
item x; // memory for x is created.
item x, y, z;
• Another way,
class item
{
……….
……….
}x, y, z;
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
Accessing Class Members
• Syntax:
object-name.function-name(argList);
• For example:
x.getdata(100,75.5);
• Similarly,
x.putdata();
• The statement like,
getdata(100,75.5);
• has no meaning. Similarly,
x.number = 100; is illegal.
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
Defining Member Functions
• A member function of a class is a function that has 
its definition or its prototype within the class 
definition like any other variable.
• It operates on any object of the class of which it is 
a member, and has access to all the members of a 
class for that object. 
• Member functions can be defined in two parts:
– Outside the class function
– Inside the class function
• Both place definition should perform same task.
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
Outside class definition
• Member functions that are declared inside a class 
have to defined separately outside the class.
• The general form of definitions is:
return-type class-name :: function-name (argList)
{
function body
}
• Membership label class-name :: tells the 
compiler that function function-name belongs 
to class-name specified in header line.
• Symbol :: is called scope resolution operator.
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
Outside class definition
• For instance, consider function getdata() and 
putdata().
• Function do not return any value, their return type 
is void.
void item :: getdata(int a, float b)
{
number = a;
cost = b;
}
void item :: putdata(void)
{
cout << “Number :” << number << “n”;
cout << “Cost :” << cost << “n”;
}
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
Inside class definition
• When  a function is defined inside a class, it is treated as 
inline function;
class item
{
int number;
int cost;
public:
void getdata(int a, float b);//declaration
//inline function
void putdata(void)
{
cout << “Number :” << number << “n”;
cout << “Cost :” << cost << “n”;
}
};
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
Inline function
• We must keep inline functions small, small inline 
functions have better efficiency.
• Inline functions do increase efficiency, but we 
should not make all the functions inline.
• Because if we make large functions inline, it may 
lead to code bloat, and might affect the speed too.
• Hence, it is advised to define large functions 
outside the class definition using scope resolution 
:: operator, because if we define such functions 
inside class definition, then they become inline 
automatically.
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
Inline function
• The compiler is unable to perform inlining if 
the function is too complicated. So we must 
avoid big looping conditions inside such 
functions.
• In case of inline functions, entire function 
body is inserted in place of each call, so if the 
function is large it will affect speed and 
memory badly.
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
Making an outside function inline:
class item
{
int number; //private by default
float cost;
public:
void getdata(int a, float b); //Declaration
};
inline void item :: getdata (int a, float b) // use membership label
{
number = a; //private variables
cost = b; //directly used
}
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
C++ program with class
#include<iostream>
using namespace std;
class item
{
int number; //private by default
float cost;
public:
void getdata(int a, float b); //Declaration
//function defined inside class
void putdata()
{
cout << "Number :" << number << endl;
cout << "Cost :" << cost << endl;
}
};
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
//............Member Function Definition................
void item :: getdata (int a, float b) // use membership label
{
number = a; //private variables
cost = b; //directly used
}
//...........Main program...................
int main()
{
item x; //create object x
x.getdata (200, 175.50); //call member function
x.putdata(); //call member function
return 0;
}
C++ program with class
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
Programming Exercise:
Define a class to display triangle:
Include the following 
members:
Data member:              
• Row 
• Column 
Member function:
• display_num_tri();
• Display_alph_tri();
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
Programming Exercise:
Define a class to interchange the values of X and Y:
Include the following members:
Data member:              
• X
• Y 
Member function:
• getdata();
• putdata();
• swapnum();
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
Programming Exercise:
Define a class to calculate area of rectangle:
Include the following members:
Data member:              
• length
• breadth
Member function:
• getdata();
• putdata();
• area();
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
Nesting of member functions
#include<iostream>
using namespace std;
class set
{
int m,n;
public:
void input(void);
int largest(void);
void display(void)
{
cout << "Largest value :" << largest() << endl;
}
};
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
//............Member Function Definition................
void set :: input (void)
{
cout << "Enter the values of m and n: " << endl;
cin >>m>>n;
}
int set :: largest()
{
if (m >= n)
return m;
else
return n;
}
//...........Main program...................
int main()
{
set x;
x.input();
x.display();
return 0;
}
Nesting of member functions
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
Private member functions
If x is an object of sample.
class sample
{
int m;
void read (void); //private member function
public:
void update(void);
void write(void);
};
x.read(); // won't work
void sample :: update (void)
{
read (); // simple call; no object used
}
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
Static data members
• Static data members  hold global data that is 
common to all objects of the class.
• For example, such global data are,
– Count of objects currently present,
– Common data  accessed by all objects, etc.
• Let us consider class Account. We  want all objects 
of this class to calculate interest at the rate of say 
4.5%.
• Therefore, this data should be globally available to 
all objects of this class.
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
Static data members
Characteristics:
• It is initialized to zero when the first object of its 
class is created. No other initialization is 
permitted.
• Only one copy of that member is created for the 
entire class and is shared by all the objects of that 
class, no matter how many objects are created.
• It is visible only within the class, but its lifetime is 
the entire program.
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
Static data members
#include<iostream>
using namespace std;
class item
{
static int count;
int number;
public:
void getdata (int a)
{
number = a;
count ++;
}
void getcount()
{
cout << "Count: " << count << "n";
}
};
int item :: count;
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
Static data members
int main()
{
item a, b, c; //count initialized to zero.
cout << "Before reading data:" << "n";
a.getcount(); //display count.
b.getcount(); //display count.
c.getcount(); //display count.
a.getdata(100); //getting data.
b.getdata(200); //getting data.
c.getdata(300); //getting data.
cout << "After reading data:" << "n";
a.getcount(); //display count.
b.getcount(); //display count.
c.getcount(); //display count.
return 0;
}
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
Static member function
• static keyword makes the function free from 
the individual object of the class and its scope is 
global in the class without creating any side 
effect for the other part of the program.
• A member function that is declared as static
has a following properties:
– A static function can have access to only other static
members (functions or variables) declared in the 
same class.
– A static member function can be called using the 
class name (instead of its objects) as follows:
class-name :: function-name;
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
Static member function:
#include <iostream>
using namespace std;
class test
{
static int c;
public:
static void count()
{
c++;
}
static void display()
{
cout << "Value of count:" << c << endl;
}
};
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
Static member function:
int test :: c;
int main()
{
test :: display();
test :: count();
test :: count();
test :: display();
return 0;
}
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
Friend function
• The central idea of encapsulation and data hiding
concept is that any non‐member function has no 
access permission to the private data of the class. 
• The private members of the class are accessed only 
from member functions of that class.
• Any non‐member function cannot access the 
private data of the class.
• C++ allows a mechanism, in which a non‐member 
function has access permission to the private 
members of the class.
• This can be done by declaring a non‐member 
function friend to the class whose private data is 
to be accessed. Here friend is a keyword.
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
Friend function
• For example, Consider a case where two 
classes, manager and scientist,  have been 
defined.
• We would like to use a function 
income_tax() to operate on the objects of 
both these classes.
• Here we declare income_tax() as friend.
• Such function need not be a member of any 
of these classes.
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
Friend function
Properties:
– There is no scope restriction for the friend function; 
hence they can called without using objects.
– Unlike member functions of a class, friend function can 
not access the members directly. On the other hand, it 
uses objects and dot operator to access private and 
public member variable of class.
– Use of friend function is rarely done, because it violates
the rule of encapsulation and data hiding.
– Function can be declared in public or private sections 
without changing its meaning.
– Usually, it has objects as arguments.
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
Friend function
#include<iostream> 
using namespace std; 
 
class account  
{ 
        char name [20]; 
        int acno; 
        float balance; 
    public: 
        void read (void) 
        { 
            cout << "Enter Name: " << endl; 
            cin >> name; 
            cout << "Enter A/c no: " << endl; 
            cin >> acno; 
            cout << "Enter Balance: " << endl; 
            cin >> balance; 
        } 
        friend void showbal (account); // declaration 
}; 
void showbal (account ac) 
{ 
    cout << "Balance of a/c no " << ac.acno << "is Rs. "<<ac.balance;  
} 
 
int main() 
{ 
    account k; 
    k.read(); 
    showbal(k); // call friend function. 
    return 0; 
} 
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
Friend function
#include<iostream> 
using namespace std; 
 
class ABC;  //forward declaration 
class XYZ  
{ 
        int data; 
    public: 
        void setvalue (int value) 
        { 
            data = value; 
        } 
        friend void add (XYZ, ABC); // declaration 
}; 
 
class ABC  
{ 
        int data; 
    public: 
        void setvalue (int value) 
        { 
            data = value; 
        } 
        friend void add (XYZ, ABC); // declaration 
}; 
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
Friend function
void add (XYZ x, ABC a) 
{ 
    cout << "Sum of data values: " << x.data + a.data <<endl;  
} 
 
int main() 
{ 
    XYZ y; 
    ABC b; 
    y.setvalue(5); 
    b.setvalue(50); 
    add(y, b); // call friend function. 
    return 0; 
}
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
Friend function
“A friend function is a non‐member function 
that has special rights to access private data 
members of any object of the class of whom 
it is a friend”.
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
Friend classes
• A class can be a friend of another class. 
Member functions of a friend class can 
access private data members of objects of 
the class of which it is a friend.
• If a class B is to be made a friend of class A, 
then the statement
friend class B;
• Should be written within the definition of 
class A.
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
Friend classes
class manager; //forward declaration
class emp
{
int eid;
char empname [10];
public:
void getdata()
{
cout << "Enter Emp ID:" << endl;
cin >> eid;
cout << "Enter Emp Name: " <<endl;
cin >> empname;
}
friend class manager;
};
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
Friend classes
class manager
{
public:
void putdata (emp e)
{
cout << "Emp ID: " << e.eid << endl;
cout << "Emp Name : " << e.empname << endl;
}
};
int main()
{
emp e;
e.getdata ();
manager m;
m.putdata (e);
return 0;
}
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
Friend classes
#include <iostream>
using namespace std;
class Square; //forward declaration.
class Rectangle
{
int width, height;
public:
void getdata(int w, int h)
{
width = w;
height = h;
}
void display()
{
cout << "Rectangle: " << width * height << endl;
}
void morph(Square);
};
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
Friend classes
class Square
{
int side;
public:
void getdata(int s)
{
side = s;
}
void display()
{
cout << "Square: " << side * side << endl;
}
friend class Rectangle;
};
void Rectangle::morph(Square s)
{
width = s.side;
height = s.side;
}
We declared Rectangle as a friend 
of Square so that Rectangle
member functions could have access 
to the private member, Square::side
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
Friend classes
int main ()
{
Rectangle rec;
rec.getdata (5, 10);
Square sq;
sq.getdata (5);
cout << "Before:" << endl;
rec.display();
sq.display();
rec.morph(sq);
cout << "nAfter:" << endl;
rec.display();
sq.display();
return 0;
}
• In our example, Rectangle is 
considered as a friend class 
by Square but Rectangle
does not consider Square to 
be a friend
• So Rectangle can access the 
private members of Square
but not the other way 
around. 
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
Array of objects:
• We can create many objects at a time.
• For example, if the name of the class is Student 
then,
Student s1,s2,s3;
• Here s1,s2,s3 are three objects .
• Consider there are so many students and therefore 
if we declare object for each student as s1,s2,s3,.sn 
it is very complicated for writing.
• For that we use array of objects
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
Array of objects:
#include<iostream> 
using namespace std; 
 
class student  
{ 
        int rno; 
        char name [20]; 
        int m1,m2; 
    public: 
        void getinfo(void) 
        { 
            cout << "Enter details of student:"; 
            cin >> rno; 
            cin >>name; 
            cin >>m1>>m2; 
        } 
        void display(void) 
        { 
            cout << "n" << rno<< "t"<< name<<"t"; 
            cout << m1 << "t" << m2 << "t" << m1 + m2; 
        } 
}; 
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
Array of objects:
int main() 
{ 
    int num; 
    cout <<"How many student records u want to enter?" << endl; 
    cin >> num; 
     
    student s[num]; // creating array of objects.. 
 
    cout << "Enter the information of "<< num << "students: " << endl;  
 
    for (int i = 0; i < num; i++) 
    { 
        s[i].getinfo(); 
    } 
 
    cout << "Students details: " << endl; 
    cout << "Roll No t" ; 
    cout << "Name t"; 
    cout << "Sub1 t Sub2 t Total"; 
 
    for (int i = 0; i < num; i++) 
    { 
        s[i].display(); 
    } 
    return 0; 
} 
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
Objects as function arguments:
#include<iostream>
using namespace std;
class time
{
int hours,minutes;
public:
void gettime(int h,int m)
{
hours=h;
minutes=m;
}
void puttime(void)
{
cout<<hours<<"hours and";
cout<<minutes<<"minutes "<<endl;
}
void sum(time,time);
};
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
Objects as function arguments:
void time::sum(time t1,time t2)
{
minutes = t1.minutes + t2.minutes;
hours = minutes / 60;
minutes = minutes % 60;
hours = hours + t1.hours + t2.hours;
}
int main( )
{
time t1,t2,t3;
t1.gettime(2,45);
t2.gettime(3,30);
t3.sum(t1,t2);
cout <<"T1 = " << t1.puttime();
cout <<"T2 = " << t2.puttime();
cout <<"T3 = " << t3.puttime();
return 0;
}
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).
To be continued…..
Nilesh Dalvi, Lecturer@Patkar-Varde
College, Goregaon(W).

More Related Content

What's hot

What's hot (20)

Chapter 02: Classes Objects and Methods Java by Tushar B Kute
Chapter 02: Classes Objects and Methods Java by Tushar B KuteChapter 02: Classes Objects and Methods Java by Tushar B Kute
Chapter 02: Classes Objects and Methods Java by Tushar B Kute
 
Static Data Members and Member Functions
Static Data Members and Member FunctionsStatic Data Members and Member Functions
Static Data Members and Member Functions
 
Constructor in java
Constructor in javaConstructor in java
Constructor in java
 
friend function(c++)
friend function(c++)friend function(c++)
friend function(c++)
 
Abstract class in java
Abstract class in javaAbstract class in java
Abstract class in java
 
Data types in c++
Data types in c++Data types in c++
Data types in c++
 
Constructors and Destructor in C++
Constructors and Destructor in C++Constructors and Destructor in C++
Constructors and Destructor in C++
 
Constructor ppt
Constructor pptConstructor ppt
Constructor ppt
 
Oop c++class(final).ppt
Oop c++class(final).pptOop c++class(final).ppt
Oop c++class(final).ppt
 
Classes and objects
Classes and objectsClasses and objects
Classes and objects
 
Java abstract class & abstract methods
Java abstract class & abstract methodsJava abstract class & abstract methods
Java abstract class & abstract methods
 
Files in c++ ppt
Files in c++ pptFiles in c++ ppt
Files in c++ ppt
 
C by balaguruswami - e.balagurusamy
C   by balaguruswami - e.balagurusamyC   by balaguruswami - e.balagurusamy
C by balaguruswami - e.balagurusamy
 
Classes and objects in c++
Classes and objects in c++Classes and objects in c++
Classes and objects in c++
 
Constructor and Destructor
Constructor and DestructorConstructor and Destructor
Constructor and Destructor
 
Object oriented approach in python programming
Object oriented approach in python programmingObject oriented approach in python programming
Object oriented approach in python programming
 
Object Oriented Programming Using C++
Object Oriented Programming Using C++Object Oriented Programming Using C++
Object Oriented Programming Using C++
 
Friend function
Friend functionFriend function
Friend function
 
Pointers in c++
Pointers in c++Pointers in c++
Pointers in c++
 
Chapter2 Encapsulation (Java)
Chapter2 Encapsulation (Java)Chapter2 Encapsulation (Java)
Chapter2 Encapsulation (Java)
 

Viewers also liked (20)

Polymorphism
PolymorphismPolymorphism
Polymorphism
 
Interoduction to c++
Interoduction to c++Interoduction to c++
Interoduction to c++
 
14. Linked List
14. Linked List14. Linked List
14. Linked List
 
Inheritance : Extending Classes
Inheritance : Extending ClassesInheritance : Extending Classes
Inheritance : Extending Classes
 
Classes and objects
Classes and objectsClasses and objects
Classes and objects
 
Input and output in C++
Input and output in C++Input and output in C++
Input and output in C++
 
C++ vs C#
C++ vs C#C++ vs C#
C++ vs C#
 
Strings
StringsStrings
Strings
 
Handling computer files
Handling computer filesHandling computer files
Handling computer files
 
Introduction to oops concepts
Introduction to oops conceptsIntroduction to oops concepts
Introduction to oops concepts
 
File handling
File handlingFile handling
File handling
 
String in c
String in cString in c
String in c
 
Classes And Objects
Classes And ObjectsClasses And Objects
Classes And Objects
 
Constructors & destructors
Constructors & destructorsConstructors & destructors
Constructors & destructors
 
Intro to C++ - language
Intro to C++ - languageIntro to C++ - language
Intro to C++ - language
 
File Handling in C++
File Handling in C++File Handling in C++
File Handling in C++
 
file handling c++
file handling c++file handling c++
file handling c++
 
File Handling In C++
File Handling In C++File Handling In C++
File Handling In C++
 
C++ programming
C++ programmingC++ programming
C++ programming
 
C++ Notes by Hisham Ahmed Rizvi for Class 12th Board Exams
C++ Notes by Hisham Ahmed Rizvi for Class 12th Board ExamsC++ Notes by Hisham Ahmed Rizvi for Class 12th Board Exams
C++ Notes by Hisham Ahmed Rizvi for Class 12th Board Exams
 

Similar to Classes and objects

Classes, objects and methods
Classes, objects and methodsClasses, objects and methods
Classes, objects and methodsfarhan amjad
 
Object oriented programming 2
Object oriented programming 2Object oriented programming 2
Object oriented programming 2Aadil Ansari
 
Oop concept in c++ by MUhammed Thanveer Melayi
Oop concept in c++ by MUhammed Thanveer MelayiOop concept in c++ by MUhammed Thanveer Melayi
Oop concept in c++ by MUhammed Thanveer MelayiMuhammed Thanveer M
 
C++ unit-2-part-3
C++ unit-2-part-3C++ unit-2-part-3
C++ unit-2-part-3Jadavsejal
 
classes & objects.ppt
classes & objects.pptclasses & objects.ppt
classes & objects.pptBArulmozhi
 
Lecture-11 Friend Functions and inline functions.pptx
Lecture-11 Friend Functions and inline functions.pptxLecture-11 Friend Functions and inline functions.pptx
Lecture-11 Friend Functions and inline functions.pptxrayanbabur
 
UNIT3 on object oriented programming.pptx
UNIT3 on object oriented programming.pptxUNIT3 on object oriented programming.pptx
UNIT3 on object oriented programming.pptxurvashipundir04
 
object oriented programming language.pptx
object oriented programming language.pptxobject oriented programming language.pptx
object oriented programming language.pptxsyedabbas594247
 
oop lecture 3
oop lecture 3oop lecture 3
oop lecture 3Atif Khan
 
Chapter 13 introduction to classes
Chapter 13 introduction to classesChapter 13 introduction to classes
Chapter 13 introduction to classesrsnyder3601
 
Unit vi(dsc++)
Unit vi(dsc++)Unit vi(dsc++)
Unit vi(dsc++)Durga Devi
 
Unit3_OOP-converted.pdf
Unit3_OOP-converted.pdfUnit3_OOP-converted.pdf
Unit3_OOP-converted.pdfPowerfullBoy1
 
PHP - Introduction to Object Oriented Programming with PHP
PHP -  Introduction to  Object Oriented Programming with PHPPHP -  Introduction to  Object Oriented Programming with PHP
PHP - Introduction to Object Oriented Programming with PHPVibrant Technologies & Computers
 
Function class in c++
Function class in c++Function class in c++
Function class in c++Kumar
 
Object Oriented Programming using JAVA Notes
Object Oriented Programming using JAVA Notes Object Oriented Programming using JAVA Notes
Object Oriented Programming using JAVA Notes Uzair Salman
 

Similar to Classes and objects (20)

Classes, objects and methods
Classes, objects and methodsClasses, objects and methods
Classes, objects and methods
 
Object oriented programming 2
Object oriented programming 2Object oriented programming 2
Object oriented programming 2
 
Oops lecture 1
Oops lecture 1Oops lecture 1
Oops lecture 1
 
Oop concept in c++ by MUhammed Thanveer Melayi
Oop concept in c++ by MUhammed Thanveer MelayiOop concept in c++ by MUhammed Thanveer Melayi
Oop concept in c++ by MUhammed Thanveer Melayi
 
C++ unit-2-part-3
C++ unit-2-part-3C++ unit-2-part-3
C++ unit-2-part-3
 
classes & objects.ppt
classes & objects.pptclasses & objects.ppt
classes & objects.ppt
 
Lecture-11 Friend Functions and inline functions.pptx
Lecture-11 Friend Functions and inline functions.pptxLecture-11 Friend Functions and inline functions.pptx
Lecture-11 Friend Functions and inline functions.pptx
 
UNIT3 on object oriented programming.pptx
UNIT3 on object oriented programming.pptxUNIT3 on object oriented programming.pptx
UNIT3 on object oriented programming.pptx
 
object oriented programming language.pptx
object oriented programming language.pptxobject oriented programming language.pptx
object oriented programming language.pptx
 
oop lecture 3
oop lecture 3oop lecture 3
oop lecture 3
 
Chapter 13 introduction to classes
Chapter 13 introduction to classesChapter 13 introduction to classes
Chapter 13 introduction to classes
 
Unit vi(dsc++)
Unit vi(dsc++)Unit vi(dsc++)
Unit vi(dsc++)
 
Unit3_OOP-converted.pdf
Unit3_OOP-converted.pdfUnit3_OOP-converted.pdf
Unit3_OOP-converted.pdf
 
Advance oops concepts
Advance oops conceptsAdvance oops concepts
Advance oops concepts
 
PHP - Introduction to Object Oriented Programming with PHP
PHP -  Introduction to  Object Oriented Programming with PHPPHP -  Introduction to  Object Oriented Programming with PHP
PHP - Introduction to Object Oriented Programming with PHP
 
Function class in c++
Function class in c++Function class in c++
Function class in c++
 
C++ tutorials
C++ tutorialsC++ tutorials
C++ tutorials
 
C++ Programming
C++ ProgrammingC++ Programming
C++ Programming
 
C++ Programming
C++ ProgrammingC++ Programming
C++ Programming
 
Object Oriented Programming using JAVA Notes
Object Oriented Programming using JAVA Notes Object Oriented Programming using JAVA Notes
Object Oriented Programming using JAVA Notes
 

More from Nilesh Dalvi

10. Introduction to Datastructure
10. Introduction to Datastructure10. Introduction to Datastructure
10. Introduction to DatastructureNilesh Dalvi
 
9. Input Output in java
9. Input Output in java9. Input Output in java
9. Input Output in javaNilesh Dalvi
 
6. Exception Handling
6. Exception Handling6. Exception Handling
6. Exception HandlingNilesh Dalvi
 
5. Inheritances, Packages and Intefaces
5. Inheritances, Packages and Intefaces5. Inheritances, Packages and Intefaces
5. Inheritances, Packages and IntefacesNilesh Dalvi
 
4. Classes and Methods
4. Classes and Methods4. Classes and Methods
4. Classes and MethodsNilesh Dalvi
 
3. Data types and Variables
3. Data types and Variables3. Data types and Variables
3. Data types and VariablesNilesh Dalvi
 
1. Overview of Java
1. Overview of Java1. Overview of Java
1. Overview of JavaNilesh Dalvi
 
Standard Template Library
Standard Template LibraryStandard Template Library
Standard Template LibraryNilesh Dalvi
 
Constructors and destructors
Constructors and destructorsConstructors and destructors
Constructors and destructorsNilesh Dalvi
 
Introduction to cpp
Introduction to cppIntroduction to cpp
Introduction to cppNilesh Dalvi
 

More from Nilesh Dalvi (17)

13. Queue
13. Queue13. Queue
13. Queue
 
12. Stack
12. Stack12. Stack
12. Stack
 
11. Arrays
11. Arrays11. Arrays
11. Arrays
 
10. Introduction to Datastructure
10. Introduction to Datastructure10. Introduction to Datastructure
10. Introduction to Datastructure
 
9. Input Output in java
9. Input Output in java9. Input Output in java
9. Input Output in java
 
8. String
8. String8. String
8. String
 
7. Multithreading
7. Multithreading7. Multithreading
7. Multithreading
 
6. Exception Handling
6. Exception Handling6. Exception Handling
6. Exception Handling
 
5. Inheritances, Packages and Intefaces
5. Inheritances, Packages and Intefaces5. Inheritances, Packages and Intefaces
5. Inheritances, Packages and Intefaces
 
4. Classes and Methods
4. Classes and Methods4. Classes and Methods
4. Classes and Methods
 
3. Data types and Variables
3. Data types and Variables3. Data types and Variables
3. Data types and Variables
 
2. Basics of Java
2. Basics of Java2. Basics of Java
2. Basics of Java
 
1. Overview of Java
1. Overview of Java1. Overview of Java
1. Overview of Java
 
Standard Template Library
Standard Template LibraryStandard Template Library
Standard Template Library
 
Templates
TemplatesTemplates
Templates
 
Constructors and destructors
Constructors and destructorsConstructors and destructors
Constructors and destructors
 
Introduction to cpp
Introduction to cppIntroduction to cpp
Introduction to cpp
 

Recently uploaded

Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)cama23
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 

Recently uploaded (20)

LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 

Classes and objects