1). Class
• Class is blue print or template in which object are created.
• We can also say that class is collection of object.
• If you want to use a class then you have to create an object.
• Ex. In our body the part call 'hand' is call class and we divide in two things like 'left hand' and 'right hand' this both is call its object
• Ex. Other example is bird in which we can say that bird is class and sparrow, parrot, duck etc. is calling its objects.
2). Object
• Object is instance of class.
• Object is showing the properties of class.
• Group of object make class.
How to define class and its object.
public class Student
{
int RollNo=0;
string Name="abc";
public string getStudent()
{
return RollNo;
}
public void setStudent(int roll,string name)
{
RollNo = roll;
Name = name;
}
}
public Static void main()
{
// make its object
Student objStudent = new Student();
objStudent.getStudent();
objStudent.setStudent(4, "Nirav Patel");
objStudent.getStudent();
}
See Also :
- Android Installation for beginners_Part-1
- Android Installation for beginners
- How to Resize a Partition in Windows 7 or Vista
- How to customize send to menu.
- How to change Folder background in windows 7
--
/\/ir@\/ <(.'.)>
0 comments:
Post a Comment
Thanks for comment