Successfully reported this slideshow.
Your SlideShare is downloading. ×

classes and objects concepts.pptx

Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Loading in …3
×

Check these out next

1 of 7 Ad
Advertisement

More Related Content

Recently uploaded (20)

Advertisement

classes and objects concepts.pptx

  1. 1. GROUP 2: CLASSES AND OBJECTS PREPARED BY: 1. AAMINO 2. CABDULAHI 3. CABDISALAM 4. CABDIQAFAR 5. AXMED XIDIG
  2. 2. OBJECTS AND CLASSES • Object − Objects have states and behaviors. Example: A dog has states - color, name, breed as well as behaviors – wagging the tail, barking, eating. An object is an instance of a class. • Class − A class can be defined as a template/blueprint that describes the behavior/state that the object of its type support.
  3. 3. OBJECTS • Let us now look deep into what are objects. If we consider the real-world, we can find many objects around us, cars, dogs, humans, etc. All these objects have a state and a behavior. • If we consider a dog, then its state is - name, breed, color, and the behavior is - barking, wagging the tail, running. • If you compare the software object with a real-world object, they have very similar characteristics. • Software objects also have a state and a behavior. A software object's state is stored in fields and behavior is shown via methods. • So in software development, methods operate on the internal state of an object and the object- to-object communication is done via methods.
  4. 4. DIFFERENCES B/W CLASSES AND OBJECTS No . Object Class 1) Object is an instance of a class. Class is a blueprint or template from which objects are created. 2) Object is a real world entity such as pen, laptop, mobile, bed, keyboard, mouse, chair etc. Class is a group of similar objects. 3) Object is a physical entity. Class is a logical entity. 4) Object is created many times as per requirement. Class is declared once. 5) Object allocates memory when it is created. Class doesn't allocated memory when it is created.
  5. 5. CREATING CLASS IN C++ class Qof{ public: string magac; int da_da; string jinsiga; void shaqo() { cout << “waan dhaqeeyaa” ; } void hurdo() { } void salaad_tukasho() { } }
  6. 6. CREATING OBJECTS IN C++ #include <iostream> using namespace std; int main () { Qof aamino; Qof cabdisalaam; Qof Cabdiqafaar; Qof Axmed_Xidig; Qof Cabdulaahi; aamino.magac = “aamino”; aamino.da_da = 20; aamino.jinsiga = “dhadig”; aamino.shaqo(); }
  7. 7. SUMMARIZE • A class is a user-defined type that describes what a certain type of object will look like. A class description consists of a declaration and a definition. ... An object is a single instance of a class. You can create many objects from the same class type.

×