Beda kelas dan obyek ==========================================Kesimpulan dari beberapa penjelasan dibawah 1. kelas merupakan
2. Obyek merupakan :
Sumber asli : | |
klik disini
-----------------------------------------------------
1. An object is an instance of a class.2. You define all the properties and functions in a class, while you use them in an object.3. Classes do not hold any information, while an object does.4. You can create subclasses, but not sub-objects.
Class : class is a blueprint or prototype from which object are created Object: Object is a Software bundles of related state and behavior.
--------------------------------------------------------------------
class:class is an abstract data type in which both Member
functions and member variable are declared that means
aclass is userdefined data type in which we will be able to
declare both methods and variable.
object : Object is an Instance of the class.The class is a
valid one when object is created.
For one class we will have more number of Objects.
declaration of class in
class classname
{
public:
Member variables;
Member functions();
protected:
Member variables;
Member functions();
Private:
Member variables;
Member functions();
};
Declaration of Objects:
class classname allaisname;
here allias name is nothing but objectname.
if we want to get the data from that particular we have to
use objects.
objectname.functionname() ------------------------------------------------------------------------
Class is just a template. It does not allocate memory space. When instantiate the object, allocates the memory space
-------------------------------------------------------------------------
I would like to explain the concept of class and object
with an example for easy understanding
consider a person 'x' has designed a car drawing the
model on a paper on computer using a software
class:this blue print is called class.
object:if a car is manufactured based on the blue print
it is one of the object created for that
particular class.------------------------------------------------------------
class is designing of a house constructed house is called object
-------------------------------------------------------------
object is real world entity. class is a collection of objects and member function .
--------------------------------------------------------------
more...Interview Questions
BalasHapusLing