TODAY JAVA SCHOOL

In java school, programming, design, computer general knowledge, web application, software, web services, social media, digital marketing, oops, concept of programming language, oops feature, console media, graphics medium, first programming, c, c ++ , Java, PHP, SQL, MySQL, HTML, HTML_5, J_query, JavaScript, Bootstrap, Framework, images with logos, examples, shared and explained.

https://www.amazon.in/b?node=26373545031&linkCode=ll2&tag=1234567801cdb-21&linkId=3b9882431b00409b44141e0344b35a15&language=en_IN&ref_=as_li_ss_tl

Breaking

Wednesday 17 June 2020

Pointer To Object In C++ | Pointer To Object In C++ Example | Pointer To Object In C++ Program | Pointer To Object In C++ Syntax |Pointer To Object In C++ In Hindi

Pointer To Object  In C++

A pointer to a C++ class is done exactly the same way as a pointer to a structure and to access members of a pointer to a class you use the member access operator -> operator, just as you do with pointers to structures. Also as with all pointers, you must initialize the pointer before using it.


image of Pointer To Object  In C++

Fig:Pointer To Object  In C++ 

Syntax:

class name *object name;


Example:

BCA *p;


Program:

#include<iostream.h>

#include<conio.h>

class BCA

{

char name[30];

int phone no;

public:

void inputdata();

void outputdata();

};

void BCA::inputdata()

{

cout<<”input name “<<endl;

 cin>>name;

cout<<”input phone no”<<endl;

cin>>phone no;

}

void BCA::outputdata()

{

cout<<name<<endl;

cout<<phone no<<endl;

}

void main()

{

BCA *p;

p->inputdata();

p->outputdata();

getch();

}


Output:

Input name Pramod

Input phone 1234567889

 


No comments:

Post a Comment