A class Is a more inporant concept in java langauge such this is more important part.we will define the method, variable and property then belongs to class.in class we will define a variable,method and declare them properly to the structure of class we will define class defination,syntax and Example of class In simple langauge.
Class : A class Is a collection Of Set Of Method And Property.
Syntax: Class class Name
{
// Body Of a class;
};
Example :
class Student
{
int id;
char Name;
};
Class : A class Is a collection Of Set Of Method And Property.
Syntax: Class class Name
{
// Body Of a class;
};
Example :
class Student
{
int id;
char Name;
};
More about Classes
- Class name must start with an uppercase letter. If class name is made of more than one word, then first letter of each word must be in uppercase.
- Classes contain, data members and member functions, and the access of these data members and variable depends on the access specifiers.
- Class's member functions can be defined inside the class definition or outside the class definition.
- Class in C++ are similar to structures in C, the only difference being, class defaults to private access control, where as structure defaults to public.
- All the features of OOPS, revolve around classes in C++. Inheritance, Encapsulation, Abstraction etc.
- Objects of class holds separate copies of data members. We can create as many objects of a class as we need.
- Classes do posses more characteristics, like we can create abstract classes, immutable classes.
0 comments:
Post a Comment