Classes and Objects in C++:
classes:
* A Class is a user defined datatype which contains the variables, properties and methods in it. ‘A class defines’ the abstract characteristics of a thing (object), including its characteristics (its attributes, fields & properties) and the thing’s behaviors (the things it can do, or methods, operations or features). One might say that a class is a blueprint or factory that describes the nature of something.
* Classes provide modularity and structure in an object-oriented computer program.
* The code for a class should be relatively self-contained (generally using encapsulation).
* Collectively, the properties and methods defined by a class are called members.
* For example, the class Dog would consist of traits shared by all dogs, such as breed and fur color (characteristics), and the ability to bark and sit (behaviors).
Objects:
* They are basic run-time entities(An entity is something that has a distinct, separate existence, though it need not be a material existence.) in an object-oriented system.
* Programming problem is analyzed in terms of objects and the nature of communication between them.
* objects communicate with each other by sending messages. They can interact without having to know details of each other’s data or code.
* Messages:The process by which an object sends data to another object or asks the other object to invoke a method.
Hope it was useful to all of u, trying hard to understand the building blocks of OOPS….!!
No comments:
Post a Comment