no default constractor ....
Code:
#include "stdafx.h"
#include<string>
using namespace std;
struct student1{
const string name;
const double salary;
const string student1::getName();
const double student1::getSalary();
};
#include "stdafx.h"
#include<iostream>
#include<string>
#include"student1.h"
using namespace std;
const string name = "Mike";
const double salary = 123.3;
const string student1::getName()
{
return name;
}
const double student1::getSalary()
{
return salary;
}
#include "stdafx.h"
#include"student1.h"
#include<string>
#include<iostream>
using namespace std;
int main()
{
student1 me;
cout << me.getName();
cout << me.getSalary();
return 0;
}
error C2512: 'student1' : no appropriate default constructor available
Whats the problem here??? and why do I have to have a constractor when using a struct...