edelossantos
asked on
class A
#include <iostream>
using namespace std;
class A {
public:
A(int x, double y, char z) {a=x;
b=y;
c=z;
}
~A();
private:
int a;
double b;
char c;
};
int main()
{
int obj(2, 20.0, 'a');
int obj_2;
obj_2 = obj;
}
output:
classA.cpp: In function `int main()':
classA.cpp:26: initializer list being treated as compound expression
using namespace std;
class A {
public:
A(int x, double y, char z) {a=x;
b=y;
c=z;
}
~A();
private:
int a;
double b;
char c;
};
int main()
{
int obj(2, 20.0, 'a');
int obj_2;
obj_2 = obj;
}
output:
classA.cpp: In function `int main()':
classA.cpp:26: initializer list being treated as compound expression
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
#include <iostream>
using namespace std;
class A {
public:
A(int x, double y, char z){
a = x;
b = y;
c = z;
}
~A(){};
private:
int a;
double b;
char c;
};
int main()
{
A obj(2, 20.0, 'a');
A obj_2;
}
output:
classA.cpp: In function `int main()':
classA.cpp:29: no matching function for call to `A::A ()'
classA.cpp:9: candidates are: A::A(int, double, char)
classA.cpp:24: A::A(const A &)
using namespace std;
class A {
public:
A(int x, double y, char z){
a = x;
b = y;
c = z;
}
~A(){};
private:
int a;
double b;
char c;
};
int main()
{
A obj(2, 20.0, 'a');
A obj_2;
}
output:
classA.cpp: In function `int main()':
classA.cpp:29: no matching function for call to `A::A ()'
classA.cpp:9: candidates are: A::A(int, double, char)
classA.cpp:24: A::A(const A &)
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
#include <iostream>
using namespace std;
class A {
public:
A(int x, double y, char z) {a=x;
b=y;
c=z;
}
~A();
private:
int a;
double b;
char c;
};
int main()
{
A obj(2, 20.0, 'a');
A obj_2;
obj_2 = obj;
}
output:
classA.cpp: In function `int main()':
classA.cpp:27: no matching function for call to `A::A ()'
classA.cpp:9: candidates are: A::A(int, double, char)
classA.cpp:22: A::A(const A &)