opino
Tripel-As
Code:
// stellt cout bereit
# include <iostream.h>
class Haus
{
public: double Gf;
double Hk;
int At;
public: Haus ()
{
cout << "klasse Haus mit standartwerten erzeugt \n";
Gf=100;
Hk=100;
At=5;
}
Haus (double g, double h, int t)
{
cout << "klasse Haus mit eingabewerten erzeugt \n";
Gf=g;
Hk=h;
At=t;
}
};
void show(Haus H)
{
cout << H.Gf << "\n";
}
int main()
{
Haus H2();
show( H2); //zeile 34
Haus * H1 = new Haus(1,1,1);
show( *H1);
return 0;
}
zwei.cpp: In function `int main()':
zwei.cpp:34: error: conversion from `Haus (*)()' to non-scalar type `Haus'
requested
So wie ich das verstanden habe ist will show als eingabewert ein objekt vom typ haus.
Das gebe ich ihm, aber wieso will es das nicht?