Class&objectt ABDULMALIK
Class&objectt ABDULMALIK
Introduction to Oops
Adjectives of this unit
- What Is Oops ?
- What are class and object ? .
- Syntax of class.
- Syntax of object.
- Example1,example2 and example3.
- What are abstraction ,encapsulation and inheritance ?
Objects Objects
Class Class
Apple Volvo
Banana Toyota
Fruit Car
Mango Hyundai
Class
Class is a diagram ,prototype and blue print
follows object.
Class is a user-defined type or data structure
declared with keyword class that has properties
”data” and actions “method ”.
Syntax of declare a class:
User defined name
class class_name
{
Keyword access specifier : //can be private, public or protected
data members; // variables to be used
member functions( ) //methods to access data members
}; //class name end with a semicolon
Object
Object is real world entity.
Object contain
- properties
- task performed .
• Object is instance of class.
• Syntax of creating a object :
ClassName objectName ;
Example 1
# include<iostream>
using namespace std; Object x
class person
{ Ahmed 15
Object s
Ali 20 getdata