SlideShare una empresa de Scribd logo
1 de 16
Class And Object
C++
Class And Object
Paradigm:A Method to Design Program.
POP(Procedural oriented
programming)
OOP(Object Oriented
Programming)
Event Dreiver
Class And Object
 POP(Procedural oriented programming):
program is divided into sub programs or modules and then assembled to form a
complete program. These modules are called functions.
• Importance is give to procedural.
• Modules(Modural Programming).
 Draro back:data was ignore.
 They were not modeling real would.
Class And Object
Class And Object
 OOP(Object Oriented Programming):Language baesd concepts of class and object.
And follow the principle
Of OOP’s
Character stices behavior
Abstraction,Encapsulation,Inheritence,Polymorphism,
Object (data)
Variables+Function
Classes
Example
class Test
{
private:
int data1;
float data2;
public:
void function1()
{ data1 = 2; }
float function2()
{
data2 = 3.5;
return data2;
}
};
Class And Object
Class And Object
Class:Collection of object of same type.
Class is a blue print of object.
Class is a user defined data type.
Class is collection of variable and function.
Object:
Any identifiable entity.
Instance of class
Memory in allocated to class after object creation.
Class And Object
Syntax of class:
Class {
data members;
members function;
};
Class classname{
Private:
.
.
Public:
.
.
Protected:
.
.
}
Class And Object
Object:Object is real entity word.with the help of object we can call the
member +data and member fuction.It is just a membership.
Syntax of Object:
Class name classobject;
Classobject.meberfunction();
Example
//Class name is Car
class Car
{
//Data members
char name[20];
int speed;
int weight;
public: //Functions
void brake(){
}
void slowDown(){
}
};
int main()
{ //ford is an object
Car ford; }
Example
class Test
{private:
int data1;
float data2;
public:
void function1()
{ data1 = 2; }
float function2() {
data2 = 3.5;
return data2; } };
int main()
{ Test o1, o2; }
Access Specifier keywords
Assess specifire keywords that specify the accessibility of a member of class.
 Private
 Public
 protected
Access Specifier
 Private:-Member declared with keyword private are known as private main
class and are not asscessable outside the class.
 Public:Public member declared with keyword public member of class and can
be access any were in the program.
 Protected:protected member declared with key protected are known as
protected and are accessable eith in sub class only
Example
/* C++ program to create a simple class and object.*/
#include <iostream>
using namespace std;
class Hello{
public:
void sayHello() {
cout << "Hello World" << endl;
}};
int main(){
Hello h;
h.sayHello();
return 0;
}
Scope resolution operator :-(::)
//C++ Program to show that scope resolution oprater is used.
// to difine a function outside a class.
::-Scope resolution used with the member which are declared inside class but
define outside the class .
It specifies the scope of member of class.
Filename scope.cpp

Más contenido relacionado

La actualidad más candente

Classes, objects in JAVA
Classes, objects in JAVAClasses, objects in JAVA
Classes, objects in JAVA
Abhilash Nair
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
Tech_MX
 

La actualidad más candente (20)

Classes, objects in JAVA
Classes, objects in JAVAClasses, objects in JAVA
Classes, objects in JAVA
 
[OOP - Lec 07] Access Specifiers
[OOP - Lec 07] Access Specifiers[OOP - Lec 07] Access Specifiers
[OOP - Lec 07] Access Specifiers
 
Inner classes in java
Inner classes in javaInner classes in java
Inner classes in java
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
 
Abstract Class Presentation
Abstract Class PresentationAbstract Class Presentation
Abstract Class Presentation
 
Object and class
Object and classObject and class
Object and class
 
Access Modifier.pptx
Access Modifier.pptxAccess Modifier.pptx
Access Modifier.pptx
 
Oops in Java
Oops in JavaOops in Java
Oops in Java
 
[OOP - Lec 19] Static Member Functions
[OOP - Lec 19] Static Member Functions[OOP - Lec 19] Static Member Functions
[OOP - Lec 19] Static Member Functions
 
Java Exception handling
Java Exception handlingJava Exception handling
Java Exception handling
 
Inheritance
InheritanceInheritance
Inheritance
 
Oops concept on c#
Oops concept on c#Oops concept on c#
Oops concept on c#
 
Seminar on java
Seminar on javaSeminar on java
Seminar on java
 
Class and object in c++
Class and object in c++Class and object in c++
Class and object in c++
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
Final keyword in java
Final keyword in javaFinal keyword in java
Final keyword in java
 
Object Oriented Programing JAVA presentaion
Object Oriented Programing JAVA presentaionObject Oriented Programing JAVA presentaion
Object Oriented Programing JAVA presentaion
 
Inheritance in c++
Inheritance in c++Inheritance in c++
Inheritance in c++
 
Object Oriented Concepts and Principles
Object Oriented Concepts and PrinciplesObject Oriented Concepts and Principles
Object Oriented Concepts and Principles
 
07. Virtual Functions
07. Virtual Functions07. Virtual Functions
07. Virtual Functions
 

Similar a Class or Object

C++ largest no between three nos
C++ largest no between three nosC++ largest no between three nos
C++ largest no between three nos
krismishra
 
Classes, objects and methods
Classes, objects and methodsClasses, objects and methods
Classes, objects and methods
farhan amjad
 
I assignmnt(oops)
I assignmnt(oops)I assignmnt(oops)
I assignmnt(oops)
Jay Patel
 
Oop lec 4(oop design, style, characteristics)
Oop lec 4(oop design, style, characteristics)Oop lec 4(oop design, style, characteristics)
Oop lec 4(oop design, style, characteristics)
Asfand Hassan
 
Application package
Application packageApplication package
Application package
JAYAARC
 
OOPS IN PHP.pptx
OOPS IN PHP.pptxOOPS IN PHP.pptx
OOPS IN PHP.pptx
rani marri
 

Similar a Class or Object (20)

oop lecture 3
oop lecture 3oop lecture 3
oop lecture 3
 
Object Oriented Programming Constructors & Destructors
Object Oriented Programming  Constructors &  DestructorsObject Oriented Programming  Constructors &  Destructors
Object Oriented Programming Constructors & Destructors
 
C++ largest no between three nos
C++ largest no between three nosC++ largest no between three nos
C++ largest no between three nos
 
Lecture 4. mte 407
Lecture 4. mte 407Lecture 4. mte 407
Lecture 4. mte 407
 
Classes, objects and methods
Classes, objects and methodsClasses, objects and methods
Classes, objects and methods
 
Lab 4 (1).pdf
Lab 4 (1).pdfLab 4 (1).pdf
Lab 4 (1).pdf
 
I assignmnt(oops)
I assignmnt(oops)I assignmnt(oops)
I assignmnt(oops)
 
Opp concept in c++
Opp concept in c++Opp concept in c++
Opp concept in c++
 
Class 7 - PHP Object Oriented Programming
Class 7 - PHP Object Oriented ProgrammingClass 7 - PHP Object Oriented Programming
Class 7 - PHP Object Oriented Programming
 
Php oop (1)
Php oop (1)Php oop (1)
Php oop (1)
 
Oop lec 4(oop design, style, characteristics)
Oop lec 4(oop design, style, characteristics)Oop lec 4(oop design, style, characteristics)
Oop lec 4(oop design, style, characteristics)
 
oopm 2.pdf
oopm 2.pdfoopm 2.pdf
oopm 2.pdf
 
Application package
Application packageApplication package
Application package
 
The smartpath information systems c plus plus
The smartpath information systems  c plus plusThe smartpath information systems  c plus plus
The smartpath information systems c plus plus
 
OOPS IN PHP.pptx
OOPS IN PHP.pptxOOPS IN PHP.pptx
OOPS IN PHP.pptx
 
My c++
My c++My c++
My c++
 
Unit 5.ppt
Unit 5.pptUnit 5.ppt
Unit 5.ppt
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented Programming
 
CS3391 -OOP -UNIT – II NOTES FINAL.pdf
CS3391 -OOP -UNIT – II  NOTES FINAL.pdfCS3391 -OOP -UNIT – II  NOTES FINAL.pdf
CS3391 -OOP -UNIT – II NOTES FINAL.pdf
 
Oop(object oriented programming)
Oop(object oriented programming)Oop(object oriented programming)
Oop(object oriented programming)
 

Último

scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
HenryBriggs2
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
MayuraD1
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
MsecMca
 
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
Health
 
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
jaanualu31
 

Último (20)

data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086
 
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
scipt v1.pptxcxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
 
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
 
kiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadkiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal load
 
AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech students
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna Municipality
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to Computers
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdf
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
Engineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planesEngineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planes
 
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
+97470301568>> buy weed in qatar,buy thc oil qatar,buy weed and vape oil in d...
 
Bridge Jacking Design Sample Calculation.pptx
Bridge Jacking Design Sample Calculation.pptxBridge Jacking Design Sample Calculation.pptx
Bridge Jacking Design Sample Calculation.pptx
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdf
 

Class or Object

  • 2. Class And Object Paradigm:A Method to Design Program. POP(Procedural oriented programming) OOP(Object Oriented Programming) Event Dreiver
  • 3. Class And Object  POP(Procedural oriented programming): program is divided into sub programs or modules and then assembled to form a complete program. These modules are called functions. • Importance is give to procedural. • Modules(Modural Programming).  Draro back:data was ignore.  They were not modeling real would.
  • 5. Class And Object  OOP(Object Oriented Programming):Language baesd concepts of class and object. And follow the principle Of OOP’s Character stices behavior Abstraction,Encapsulation,Inheritence,Polymorphism, Object (data) Variables+Function Classes
  • 6. Example class Test { private: int data1; float data2; public: void function1() { data1 = 2; } float function2() { data2 = 3.5; return data2; } };
  • 8. Class And Object Class:Collection of object of same type. Class is a blue print of object. Class is a user defined data type. Class is collection of variable and function. Object: Any identifiable entity. Instance of class Memory in allocated to class after object creation.
  • 9. Class And Object Syntax of class: Class { data members; members function; }; Class classname{ Private: . . Public: . . Protected: . . }
  • 10. Class And Object Object:Object is real entity word.with the help of object we can call the member +data and member fuction.It is just a membership. Syntax of Object: Class name classobject; Classobject.meberfunction();
  • 11. Example //Class name is Car class Car { //Data members char name[20]; int speed; int weight; public: //Functions void brake(){ } void slowDown(){ } }; int main() { //ford is an object Car ford; }
  • 12. Example class Test {private: int data1; float data2; public: void function1() { data1 = 2; } float function2() { data2 = 3.5; return data2; } }; int main() { Test o1, o2; }
  • 13. Access Specifier keywords Assess specifire keywords that specify the accessibility of a member of class.  Private  Public  protected
  • 14. Access Specifier  Private:-Member declared with keyword private are known as private main class and are not asscessable outside the class.  Public:Public member declared with keyword public member of class and can be access any were in the program.  Protected:protected member declared with key protected are known as protected and are accessable eith in sub class only
  • 15. Example /* C++ program to create a simple class and object.*/ #include <iostream> using namespace std; class Hello{ public: void sayHello() { cout << "Hello World" << endl; }}; int main(){ Hello h; h.sayHello(); return 0; }
  • 16. Scope resolution operator :-(::) //C++ Program to show that scope resolution oprater is used. // to difine a function outside a class. ::-Scope resolution used with the member which are declared inside class but define outside the class . It specifies the scope of member of class. Filename scope.cpp