0

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 :)

5
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by homeryansta
0

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 by Fbody: n/a

0

>> 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

0

>> 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 topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.