I have class A with constructor A(int a)
A.h
calss A{
public : A(int a);
}
A.cpp
#include "a.h"
#include <iostream>
A::A(int a)
{
std::cout<<a<<end;
}
I need to initialize this class from another class B,
I tried
B.h
class B{
public : B();
A tmp;
//A tmp(4); //this giving syntax error
}
and
B.cpp
B(){
tmp = A(4);
}
But I am getting compiler error "error: no matching function for call to 'A::A()'
"