Static Object: – / Array of objects: –

Static Object: - When at the time of declaration of object, if we prefixed static keyword then the object said to be static object. The purpose of making an object as static to initialize all non-static member variable with 0 rather than garbage value. Array of objects: - It is also possible to create an... Continue Reading →


Static member function: –

Static member function: - Before member function if the static keyword is prefix then member function is said to be static member function. It has some rules to be followed – (1) It is only used to access static member variable and static member function. (2) We can call public static member function either through... Continue Reading →

Static member Variable: –

Static member Variable: - When the member variable is prefixed with static keyword then the member variable is said to be static member variable. The few points about static member variable are – (1) It is associated with class rather than object. (2) Unlike non-static member variable, it is created only once separately outside the... Continue Reading →

Class, object and their memory: –

Class, object and their memory: - Class does not have physical existence so the memory for member variable will not be provided inside the class. Object has physical existence so the memory for member variables will be provided inside the object when object is created. When the object is created, all non-static member variables either... Continue Reading →

Defining member function: –

Defining member function: - We have two ways to define member function (1) Inside the class and (2) Outside the Class. Inside the class: - When we have less number of codes for a member function then we usually prefer to define the member function inside the class. The member function defined inside the class... Continue Reading →

Access Specifier/modifier: –

Access Specifier/modifier: - It is use to specify the accessibility of data. There are three types of it – Public Private Protected Public: - When the member of class is created inside public section then that member will be called as public member of that class. Syntax: -                 Public: Note: - The member inside... Continue Reading →

Object: –

Object: - It is an entrains of class. Object is also called as run time or execution time entity. Object has physical existence so at execution time whenever the object will be created then after creation of that object, all non-static member variables will be immediately stored inside that object. Syntax: - Object Declaration or... Continue Reading →

Class: –

Class: - It is a blue print (structure) in which we bind or pack member variable, member function, constructor and destructor etc. A class can have n number of member variables either of same type of different type. So we can also say that a class maintains the record. Syntax: -                 Class Class_Name                ... Continue Reading →

149. Write a program to pass object by call by value technique?

#include<iostream.h> #include<conio.h> class validity { private:                 int mfg,exp,yr; public:                 void read()                                 {                                 cout<<"Enter Manufacturing Year of Product : ";                                 cin>>mfg;                                 cout<<"Enter Expiry Year of Product : ";                                 cin>>exp;                                 }                 void period(validity obj)                                 {                                 yr=obj.exp-obj.mfg;                                 cout<<"The Valid Period of Product Is : "<<yr;                                ... Continue Reading →

Create a website or blog at

Up ↑

%d bloggers like this: