Explain with an example how one user defined data type can be converted to a predefined data type.
User defined data type:
A data type, which are defined by the user are called the derived data type. It is also called the user defined data type. example
#include <bits/stdc++.h>
using namespace std;
class Test {
public:
string test;
void printname()
{
cout << "Test: " << test;
}
};
int main()
{
Test test1;
test1.test = "Testing done";
test1.printname();
return 0;
}
Predefined data type:
A fundamental data types are called the predefined data type. Which are directly used to store the values. for example int, char, float etc.
Comments
Leave a comment