Accessing a integer in one class/method/function from another

I'm pretty new to programming, though I have done some c# (a small amount).
Sorry for the class/method/function confusion, I didn't know what to call it. Anyway you'll be able to see what I mean from my code.

I'm building a aquarium controller for my marine fish tank which I want to be able to control lighting, temp, pumps etc etc.
I've got the real time clock and temp monitor working, but I'm having trouble.

Anyway I have this piece of code below:
void lightmode(){

if (printDate.hour >= 9 && printDate.hour <= 18)
{
Serial.println("Lights are enabled");
}

which I want to call this class(?): void printDate(){ .
But i'm getting this error: "request for member 'hour' in 'printDate', which is of non-class type 'void ()()'"

Do I have to set them as public or something like I would in c#? I tried and failed miserably.
I uploaded the .ino file as well if that helps.

Thanks

AquariumController.ino (2.63 KB)

I want to call this class(?):

You want to do what??? You want to call this 'Function'.

(1) printDate() is a function, you can't access local variables from one function inside another.
(2) what are you actually trying to do?

I presume what you want to do is something like follows:
(1) have some function which gets the current date and time from your controller
(2) do something which uses the current date/time

So you need some way of storing all the second, minute, hour, etc. The easiest way would be to make these global variables rather than local ones. That way all of your functions will have access to it.

Yeah I would have called it a function/method but when I was searching for help with this before posting I found someone with a similar problem who called it classes. But I guess he was talking about something entirely different.

Thanks Tom, I figured it out, i declared the hour as a global at the top of the code, changed the hour to not be a new integer, and added the function inside the loop. All working as expected.

Thanks

Some terminology clarification:

1. Class

A data structure definition capable of containing functions, variables, etc, with access security (private / public etc) and inheritance.

class foo {
  public:
    int bar;
    void doSomething();
};

2. Object (AKA Class Instance)

Any instance of a class stored in a variable.

foo MyFoo();
// or...
foo *MyFoo = new foo();

3. Function

A block of code located away from the main flow of code which the code "branches" to for execution.

void doSomething() {
  // Something is done
}

4. Member Function (aka Method)

Any function which is contained within a class.

void foo::doSomething() {
  // Something is done inside the foo class with the data from the current foo object
}