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 9306531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T00:11:39+00:00 2026-06-19T00:11:39+00:00

I have made some static functions in order to call them without making any

  • 0

I have made some static functions in order to call them without making any object of the class they belong to. I have included the header file of the class with the static functions (NTP.h) into another class (DayNumber).

I want to place the returns of some functions as operants of a functions of DayNumber class. I get error that NTP has not been declared. Here it is the code.

Header file:

#include "NTP.h"

class DayNumber{
    private:
        int _day1YearLoop[];
        int _day4YearLoop[];

    public:
        int Days1YearLoop;
        int Days4YearLoop;

        DayNumber();
        void dayNumberCalc( NTP::getYear(),NTP::getMonth(),NTP::getDate());
        virtual ~DayNumber();

        bool checkLeapYear(int setYear);
};

#endif

Implementation .cpp file(part of it):

void DayNumber::dayNumberCalc( NTP::getYear(), NTP::getMonth(), NTP::getDate()){
    int setYear = NTP::getYear();
    int setMonth = NTP::getMonth();
    int setDay = NTP::getDate();
    //Days that passed from the beginning of the year for the first day each month
    int _day1YearLoop[] = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
    //i= _day1YearLoop;

    //Days that passed from the beginning of the second year since the 'for'.
    //The first day of the running year in a four-years loop.
    int _day4YearLoop[]={366,731,1096};

    if (checkLeapYear(setYear)){
        if (setMonth>2){ //Diorthwsi gia ton mina flebari
            Days1YearLoop = *(_day1YearLoop + (setMonth-1)) + setDay + 1;
            Days4YearLoop = Days1YearLoop;
        }
        else{
            Days1YearLoop = *(_day1YearLoop+(setMonth-1))+setDay;

Why is that happening? Isn’t it supposed to work this way?

Also inside the function dayNumberCalc should I save the returns of the static functions in local variables and use them instead of the returns?

  • 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-06-19T00:11:40+00:00Added an answer on June 19, 2026 at 12:11 am

    The syntax for your function declaration is incorrect:

    void dayNumberCalc( NTP::getYear(),NTP::getMonth(),NTP::getDate());
    

    You’re supposed to list the argument types and names here. Perhaps you wanted:

    void dayNumberCalc(int year, int month, int day);
    

    Then you would call it with:

    dayNumber.dayNumberCalc(NTP::getYear(),NTP::getMonth(),NTP::getDate());
    

    Alternatively, if you want the static members of NTP to be called from within dayNumberCalc, give it no arguments:

    void dayNumberCalc();
    

    Or, if you want to have arguments that have default values given by the static functions, do:

    void dayNumberCalc(int year = NTP::getYear(), int month = NTP::getMonth(),
                       int day = NTP::getDate());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have made some changes in one perforce client, but haven't submitted them. I
I have a public class which has some common generic functions, like e.g. for
I have made some progress with the DataList and UserControl this morning but I
I have made some screenshots of my website, and in internet explorer 6 my
I have made some screenshots of my website, and in internet explorer 6 my
I have a datagrid in C#.net I have made some columns in grid editable.
I posted a thread about this earlier and have made some progress but now
I'm using Pex and Moles 0.94.51023.0 with VS2010 SP1. I have successfully made some
i have made columns in some of the tables encrypted in sql server 2008.
I have recently made changes in some code that makes a char name field

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.