How to Write a program in C++ to create a class called student with one private data member called m, of type into, and two public member function putdata() and getdata()?

1

1 Answers

Amit Tiwari Profile
Amit Tiwari answered
#include<iostream.h>
#include<conio.h>
class student
{
private int m;

public void putdata()
{
cout<<"Enter the value of m";
cin>>m;
}
public void getdata()
{
cout<<"The Value of Private Member is"<<m;
}
public void main()
{
student s = new student();
s.putdata();
s.getdata();
getch();
}

Answer Question

Anonymous