Please help me with my problem in algorithm coding.. the error says no matching function call .. i attach the picture in this thread hoping u help me :)

Your function is defined as

int BinaryTree::getLeafCount(struct node *node) {

Notice the node* parameter...
But your call is

b.getLeafCount();

Notice the lack of an argument...

Basically, because you didn't call it properly, you've unintentionally overloaded the function, but you don't have a definition/implementation of the overloaded version.

Edited 5 Years Ago by Fbody: n/a

>> Basically, because you didn't call it properly, you've unintentionally overloaded the function, but you don't have a definition/implementation of the overloaded version.
i think you'r wrong about that, you cant declare a function as this

b.getLeafCount();

you must use :: operator to tell the compiler that it belongs to a class, not the '.' operator

>> Basically, because you didn't call it properly, you've unintentionally overloaded the function, but you don't have a definition/implementation of the overloaded version.
i think you'r wrong about that, you cant declare a function as this

b.getLeafCount();

you must use :: operator to tell the compiler that it belongs to a class, not the '.' operator

No, he's completely right. b.getLeafCount(); is not a declaration. It's a call to the getLeafCount(); method in the class named b. If he had used BinaryTree::getLeafCount() in the correct place in the code, he would have an overloaded function.

This article has been dead for over six months. Start a new discussion instead.