Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6919593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:00:39+00:00 2026-05-27T10:00:39+00:00

I am building a templated class myTree that includes a private struct myNode. I

  • 0

I am building a templated class “myTree” that includes a private struct “myNode”. I also have a private function “findNode” which I would like to return a myNode*. However, when I try and define the “findNode” I am getting 5 errors saying that seem to stem from the first error which says that I am missing a semicolon in between “myNode” and the “*”.

Here is the basic code:

template <size_t N, typename ElemType>
class myTree {
public:
  //...
private:
  struct myNode{
    //...
  };
  myNode* findNode(const otherClass<N>& key);
};

template <size_t N, typename ElemType>
myNode* myTree<N, ElemType>::findNode(const otherClass<N>& key) {
  return 0;
}

I tried changing the return type to void and the errors disappeared, meaning I assume that there is something wrong with the way I am using my struct.

The errors are:
1) Syntax error: missing ‘;’ before ‘*’
2) missing type specifier – int assumed
3) ‘N’ undeclared identifier
4) ‘ElemType’ undeclared identifier
5) ‘N’ undeclared identifier

These all point to the function declaration line ( myNode* myTree::findNode(const otherClass& key) { ).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T10:00:39+00:00Added an answer on May 27, 2026 at 10:00 am

    myNode is an inner class and needs to be qualified in a return type:

    template <size_t N, typename ElemType>
    typename myTree<N,ElemType>::myNode*
    myTree<N, ElemType>::findNode(const otherClass<N>& key)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building a hashmap class that can have string keys and ints, bools, strings
I'm building a HTML template for my site and would like to have a
Does anyone have any references for building a full Object/Class reflection system in C++
I'm building my own matrix class to solidify my c++ understanding. It's templated, so
I building a simple class that is supposed to mimic the functionality of the
I'm building little class called Output ... It's meant to be something that will
I'm building a preview function into the CMS for my website which uses the
The Application I am building an application which includes a range selector. This consists
#include<iostream> template<class T> struct Foo { T v_; Foo(T&& v):v_(std::forward<T>(v)) { std::cout << building
building a site using PHP and MySQL that needs to store a lot of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.