hi ,
i'm new in programming world
i want to write c++ class
in c it was ok ..
when i change to c++
i've problems
#include <iostream>
using std::cin; // using std::setprecision;
using std::cout; using std::string;
using std::endl; // using std::streamsize;
class STD1{
int id;
string name ;
char status;
void::pinfo();
void::ginfo();
};
void STD1::ginfo(){
cout<<"Enter ID : ";
cin>>id;
cout<<"\nEnter Name : ";
cin>>name;
cout<<"\nEnter Status : ";
cin>>status;
}
void STD1::pinfo(){
cout<<"Student Info Is ... ID : "<<id <<" Name : "<<name <<" Status : "<<status;
}
void main()
{
STD1 m;
m.ginfo();
m.pinfo();
}
the errors i've see is :
1>c:\users\m\documents\visual studio 2008\projects\m\m\class.cpp(29) : error C2248: 'STD1::ginfo' : cannot access private member declared in class 'STD1'
1> c:\users\m\documents\visual studio 2008\projects\m\m\class.cpp(12) : see declaration of 'STD1::ginfo'
1> c:\users\m\documents\visual studio 2008\projects\m\m\class.cpp(6) : see declaration of 'STD1'
1>c:\users\m\documents\visual studio 2008\projects\m\m\class.cpp(30) : error C2248: 'STD1::pinfo' : cannot access private member declared in class 'STD1'
1> c:\users\m\documents\visual studio 2008\projects\m\m\class.cpp(11) : see declaration of 'STD1::pinfo'
1> c:\users\m\documents\visual studio 2008\projects\m\m\class.cpp(6) : see declaration of 'STD1'
1
can any one solve problem and tell me what should i do
i'm waiting ..
thanks