Professional Documents
Culture Documents
WWW - Kutub.info 6782
WWW - Kutub.info 6782
Class is part of the program which contains methods and other instruction
the user can use it to do oprations
constructor -1
when Constructor is class methods have the same class name that are executed
an object is created
access modifiers -2
Access modifiers are keywords that you can add to members of a class to
restrict their access
public class A
{
private int v;
public int w;
protected int x;
internal int y;
This document is prepared by Ma7amed Amged
2nd year SHA
keyword indicates that the data member is only visible within the
oop
:
class member data member main -
1
2
3
4
- 1
amged - 2
This document is prepared by Ma7amed Amged
2nd year SHA
.2 data member
class amged
{
;public int id
;public string name
}
--------------------------
constructor with parameter.1
constructor without parameter.2
class amged
{
>>>//<<<--data member blow---
;public int id
;public string name
>>>>//<<<---i will create constractor---
public amged()//this is the cinstructor without parameter
{
}
amged
:
data
members data memebers
class amged
This document is prepared by Ma7amed Amged
2nd year SHA
{
>>>//<<<--data member blow---
;public int id
;public string name
>>>>//<<<---i will create constractor---
)(public amged
{
;int a = 5
;"string b = "the name
;a = id
;b = name
}
}
name
id
!! lol :D
id ,name
constractor with parameter
class amged
{
>>>//<<<--data member blow---
;public int id
;public string name
>>>>//<<<---i will create constractor with parameter---
)public amged(int c,string d
{
;c = id
;d = name
}
}
Parameter variable
id,name,c,d
input
class amged
This document is prepared by Ma7amed Amged
2nd year SHA
{
//<<<--data member blow--->>>
public int id;
public string name;
//<<<---i will create constractor without parameter--->>>>
public amged()
{
int a = 5;
string b = "the name";
this.id = a ;
this.name =b ;
}
//<<<---i will creat constructor with parameter--->>>
public amged(int c,string d)//
{
This.id = c ;
This.name= d ;
}
amged 2
!! this
data members calling
this
**
.... !!!
**
!!!
main
Making the object @ main
This document is prepared by Ma7amed Amged
2nd year SHA
Ma7amed_glaiseen@yahoo.com