Class:-class are reference data types based on which objects are created. Objects with similar properties and methods are grouped together to form a Class. Thus a Class represents a set of individual objects. Characteristics of an object are represented in a class as Properties. The actions that can be performed by objects become functions of the class and is referred to as Methods.(collection of Variables, collection of Method and property)
class class_name
{
class Member (Method, Variable, constructor etc..)
}
Object:-Object is the basic unit of object-oriented programming. Objects are identified by its unique name. An object represents a particular instance of a class. There can be more than one instance of an object. Each instance of an object can hold its own relevant data. An Object is a collection of data members and associated member functions also known as methods.a person or thing to which a specified action or feeling is directed.Real-world objects share two characteristics: They all have state and behavior.
object create syntax:- ClassName objectName = new ClassName();
Example :-
class class_name
{
class Member (Method, Variable, constructor etc..)
}
Object:-Object is the basic unit of object-oriented programming. Objects are identified by its unique name. An object represents a particular instance of a class. There can be more than one instance of an object. Each instance of an object can hold its own relevant data. An Object is a collection of data members and associated member functions also known as methods.a person or thing to which a specified action or feeling is directed.Real-world objects share two characteristics: They all have state and behavior.
object create syntax:- ClassName objectName = new ClassName();
Example :-

Object is real world entity which has state and behavior
ReplyDeleteThese objects share two characteristics:
State
Behavior