26
CLASS OBJECTS, CONSTRUCTOR & DESTRUCTOR Object Oriented Programming COMSATS Institute of Information Technology

Oop lec 5-(class objects, constructor & destructor)

Embed Size (px)

Citation preview

  1. 1. CLASS OBJECTS, CONSTRUCTOR & DESTRUCTOR Object Oriented Programming COMSATS Institute of Information Technology
  2. 2. Book ClassObject Oriented Programming#include #include Data Hiding class book{ Data is concealed within the class private: char name[25]; Cannot be access by function int pages; outside the class float price; Primary mechanism to hide data public: is to make it private void changeName(char *n){ Private data and function can strcpy(name, n); Class only be access from within the } Definition class void changePages(int p){ pages = p; } void changePrice(float p){ price = p; } void display(){ cout