objects and classes in inheritance
Hi guys,
I have just made a program of class in which their are base and derived classes . The program is as follows:
------------------------------------------------------------------
Code:
class Vehicle
{
private:
char Name;
string id;
public:
void getName();
void setName();
void setid();
void getid();
};
main()
{
Vehicle veht;
// These are the functions I am using to access the data members of the class Vehicle/
veht.getName();
veht.getid();
}
---------------------------------------------------------------
In the main() part of the program I have made the object "veht" for the class Vehicle so I can access the "Name" and "id" of the class Vehicle from outside of the class.
Now will I be able to access the private data members "Name" and "id" of the class Vehicle using the functions that I have written in main()?
Pls correct me if I am wrong.
Thanks
----------------------------------------------------------------