class B { public: B() { } }; class A { public: A() { } void setB(B bb) { b = bb; } B getB() { return b; } private: B b; }; int main(int argc, char *argv[]) { A *tt= new A(); B s(); tt->setB(s); return 0; } tzu.cpp: In member function `B A::getB()': tzu.cpp:281: error: conversion from `B*' to non-scalar type `B' requested tzu.cpp: In function `int main(int, char**)': tzu.cpp:295: error: no matching function for call to `A::setB(B (*)())' tzu.cpp:276: note: candidates are: void A::setB(B*)