preview

The New Operator Instantiates A Class

Good Essays

OBJECT: refers to a particular instance of a class where the object can be a combination of variables, functions, and data structures.
INSTANCE: The new operator instantiates a class by allocating memory for a new object and returning a reference to that memory, "instantiating a class" means the same thing as "creating an object." When you create an object, you are creating an "instance" of a class.
CLASS: It is a template that describes the data and behavior associated with instances of that class. When you instantiate a class you create an object that looks and feels like other instances of the same class.
A class is a blueprint which you use to create objects. An object is an instance of a class - it 's a concrete 'thing ' that you …show more content…

Animal a = new Animal (); a. Roar (); // The compiler can resolve this method call statically. Dynamic binding means that references are resolved at run time

METHOD; MESSAGE: Method is a function or procedure that is defined for a class and typically can access the internal state of an object of that class to perform some operation. While message is refer to instruction that is send to object which will invoke the related method.
ENCAPSULATION; INHERITANCE; POLYMORPHISM:
Encapsulation: is binding the data with the code that manipulates it and keeps the data and the code safe from external interference.
Inheritance: is the mechanism by which an object acquires the some/all properties of another object. It supports the concept of hierarchical classification.
Polymorphism: means to process objects differently based on their data type.
In other words it means, one method with multiple implementation, for a certain class of action. And which implementation to be used is decided at runtime depending upon the situation (i.e., data type of the object)
This can be implemented by designing a generic interface, which provides generic methods for a certain class of action and there can be multiple classes, which provides the implementation of these generic methods.
PROPERTY; METHOD; ATTRIBUTE
Attribute: is a quality or object that we attribute to someone or something. For example, the scepter is an attribute of power and statehood.
Property: is a quality

Get Access