142. Write a program to access public, private and protected member of class?

#include<iostream.h> #include<conio.h> class demo {                 int x;                 void display()                                 {                                 cout<<"X = "<<x<<endl;                                 cout<<"Y = "<<y<<endl;                                 cout<<"Z = "<<z<<endl;                                 } protected:                 int y;                 void access()                                 {                                 x=10;                                 y=20;                                 z=30;                                 display();                                 } public:                 int z;                 void read()                                 {... Continue Reading →

Advertisements

141. Write a program to access protected members of a class?

#include<iostream.h> #include<conio.h> class demo { protected:                 int x;                 void display()                                 {                                 cout<<"\nX = "<<x<<endl;                                 } public:                 void read()                                 {                                 cout<<"Enter The Value of X = ";                                 cin>>x;                                 display();                                 } }; void main() {                 demo d;                 clrscr();                 d.read();                 getch(); }

140. Write a program to access private member of a class?

A. #include<iostream.h> #include<conio.h> class demo { private:                 int x; public:                 void read()                                 {                                 cout<<"Enter The Value of X : ";                                 cin>>x;                                 }                 void display()                                 {                                 cout<<"\nX = "<<x<<endl;                                 } }; void main() {                 demo d;                 clrscr();                 d.read();                 d.display();                 getch(); }... Continue Reading →

139. Write a program to access public member of a class?

  A. #include<iostream.h> #include<conio.h> class demo { public:                 int x;                 float y; }; void main() {                 clrscr();                 demo d;                 d.x=10;                 d.y=20.5;                 cout<<"The Value of X = "<<d.x<<endl;                 cout<<"The Value of Y = "<<d.y<<endl;                 getch(); } B. #include<iostream.h> #include<conio.h> class demo { public:                 int x;                ... Continue Reading →

Visual basic database: –

Visual basic database: - A database can be viewed as a set interrelated data item. Database management deals with storage, retrieval, and editing of data with in data base. The main function of data base are security and validations of data items for data base. Visual basic makes a simple to handle data base by... Continue Reading →

String library function: –

String library function: - String library function are available inside string.h. The purpose of string library functions are to support all the necessary operation to process the string. The few example of string library function are as bellow – strlen(); strcmp(); strcpy(); strcat(); strrev(); strupr(); strlwr(); String length (strlen()): - This function is used to... Continue Reading →

String: –

String: - It is a set of characters enclosed within pair of double quotes. Ex: - “Hello”, “A”, “786”, “8”, “Hello World” etc. In order to use string value, we can have two type of variables. Array of character: - Declaration for array of character. Syntax: -                 Char Array_Variable_Name[Size]; Ex: -                 char name[20];... Continue Reading →

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: