Computer Science, asked by MalbinNayak, 1 year ago

With the help of a suitable example explain the concept of object and classes​

Answers

Answered by charlie1505
1

Answer:

What is Class?

A class is an entity that determines how an object will behave and what the object will contain. In other words, it is a blueprint or a set of instruction to build a specific type of object.

Syntax

class <class_name>{

field;

method;

}

What is an Object?

An object is nothing but a self-contained component which consists of methods and properties to make a particular type of data useful. Object determines the behavior of the class. When you send a message to an object, you are asking the object to invoke or execute one of its methods.

From a programming point of view, an object can be a data structure, a variable or a function. It has a memory location allocated. The object is designed as class hierarchies.

Syntax

ClassName ReferenceVariable = new ClassName();

Similar questions