- #1
member 428835
Any idea what I'm doing wrong in the code below? It seems lines 15-16 are the problem. I thought ptr2 was a pointer. What am I missing?
C++:
#include <memory>
#include <iostream>
class c1 {
public:
void f1() {
std::cout<<"im a class \n";
}
};
int main()
{
c1* ptr;
ptr->f1();
auto ptr2 = std::make_shared<c1>;
ptr2->f1();
return 0;
}
Last edited by a moderator: