cambalinho 142 Practically a Posting Shark

i don't want bored you.(imagine that we don't tests() have inside of macro)
why i can see in list when i do 'void a::'?
what i need is use them without declare them inside of macro.
but seems, like you said, that i can't :(
ok..thanks for all.. thanks

cambalinho 142 Practically a Posting Shark

i will explain better;)
but let me ask you 1 thing: i must declare all virtual functions or theres another command for do it?
(if there isn't i must give up on these code :()
imagine that Y have 10(or more) virtual functions, i must declare the 10. or theres another way for have them?

cambalinho 142 Practically a Posting Shark

i fix it:

    #define EVENTS2(Y,X) \
    class X : public Y { public: \
    X(); \
    ~X(); \
    } X;

class b
{
    public:
    virtual void tests(){};
    b()
    {
        tests();
    }
};


EVENTS2(b,a);

a::a()
{
    cout << "oi";
}

a::~a()
{
    cout << "bye";
}

but see 1 problem.
the class 'a' needs declare the base functions(the virtual functions). how can i do it inside of macro?

cambalinho 142 Practically a Posting Shark

thanks for the tutorial about macros my friend.
i belive the macro have 1 problem:

#define write(x)  cout<< x

    #define EVENTS2(Y,X) \
    class events3 : public Y { public: \
    events3(); \
    ~events3(); \
    } X;

class b
{
    public:
    virtual void tests(){};
    b()
    {
        tests();
    }
};


EVENTS2(b,a);

void a::tests()
{
    cout << "oi";
}

because of these error:
"C:\Users\Joaquim\Documents\CodeBlocks\My Class\main.cpp|29|error: 'a' is not a class, namespace, or enumeration|"

cambalinho 142 Practically a Posting Shark

i'm using code::blocks becuase of my big project ;)
sorry about that declaration mistake.
but let see the 1st error:
"C:\Users\Joaquim\Documents\CodeBlocks\My Class\main.cpp|7|error: macro names must be identifiers|"
what i miss up with my macro?

cambalinho 142 Practically a Posting Shark

maybe these can helps:

const int BLACK         = 0;
cambalinho 142 Practically a Posting Shark

"But again, why is it that it works in main.cpp but not in dummy.h? If NULL is undefined, it shouldn't have worked even in main.cpp, right?"
i think it's the dependency libraries. like i did with code.
maybe the zbar.h depends on other header files.

cambalinho 142 Practically a Posting Shark

just for test these:

#ifndef DUMMY_H
#define DUMMY_H

#include <iostream>
#include <Magick++.h>
#include <zbar.h>
#include <highgui.h>
#include <cv.h>

using namespace std;
using namespace zbar;
using namespace cv;

class dummy{
public:
    dummy();
};

#endif // DUMMY_H

tell me if you don't get any errors

cambalinho 142 Practically a Posting Shark

you can open the .cpp file with notepad. maybe these helps you

cambalinho 142 Practically a Posting Shark

cout print something on console screen. in these case will print '5', because 5.0/2 will be 2.5(because the 1st number will be considered float\double), and multiply by 2 will be 5.
anotherthing: the '()' is more important on math than '*'. it's the operations order sequency like math.
i hope help you

cambalinho 142 Practically a Posting Shark

i understand that the macro is a code that is changed before compile it.
so i did these macro with these code:

#define (events2((y),(x))) (class events3 : public ( y ) { events3(); ~events3(); }(x) ; )
//#define (events2((y),(x))) (class events3 : public ( y ) { events3(); }(x) ; )
//#define (events2((y),(x))) (class events3 : public ( y ) { ~events3(); }(x) ; )
//#define (events2((y),(x))) (class events3 : public ( y ) { }(x) ; )

class b
{
    public:
    virtual void tests(){};
    b()
    {
        tests();
    }
};


events2( b) a;

void a::tests()
{
    write("oi");
}

and i get these errors:
"C:\Users\Joaquim\Documents\CodeBlocks\My Class\main.cpp|7|error: macro names must be identifiers|
C:\Users\Joaquim\Documents\CodeBlocks\My Class\main.cpp|23|error: expected constructor, destructor, or type conversion before 'a'|
C:\Users\Joaquim\Documents\CodeBlocks\My Class\main.cpp|25|error: 'a' has not been declared|
||=== Build finished: 3 errors, 0 warnings (0 minutes, 0 seconds) ===|"

what i'm doing wrong with these macro?

cambalinho 142 Practically a Posting Shark

now i know the corrupted(or something that can happen) cookies, can make problems for login.
thanks for all
my real name is Joaquim Miguel... from portugal.
i use these nickname(have 1 nice little history), because i love it ;)

cambalinho 142 Practically a Posting Shark

(i think you recive mails from me (cambalinho_83@hotmail.com)... sorry about that, but wasn't easy to come back :()
after some time yes ;)
but let me ask you: the coockies can realy affect the logins?

cambalinho 142 Practically a Posting Shark

why here don't use the template arguments?
see page 3('codigo-fonte'): https://dl.dropboxusercontent.com/u/28818654/Community/templates.pdf

cambalinho 142 Practically a Posting Shark

see these sample:

template <typename a>
class test
{
  test(a argument)
  {
     cout << argument;
  }
};

//declare it:
int main()
{
   test<string> a("hello");
}

how can i do it:

test a("hello");
cambalinho 142 Practically a Posting Shark

on login. i forget the password. i mistake it several times. then i did the reset of password. i receive the mail for reset it, but your forum give me an error:

Oops!
Nothing to see here, folks! We don't know who you are. Try joining our community or logging in to access this page.
Go Back

i try several times but with same error.
then i send a mail to dani@daniwebmail.com
i don't know if she(i think is a she) did something to my account for help. but i clean all coockies and temporary files. then i try again and works.
so the coockies can affect the longins?

cambalinho 142 Practically a Posting Shark

these class was more complicated.. so i did the other.
these topic i will put 'resolved', but i accept sugestions for these class;)
thanks to all

cambalinho 142 Practically a Posting Shark

finnaly the code is done... now the C++ programmers can do nice events:

//events.h
#ifndef events_H_INCLUDED
#define events_H_INCLUDED

#include <functional>
#include <vector>

template <typename ... b>
class events
{
public:
    typedef std::function<void(b...argx )> OnSomethingHandler;

    events(OnSomethingHandler Handler)
    {
        handlers_=Handler;
    }

    void operator ()(b... args)
    {
        handlers_(args...);
    }
    events& operator = (OnSomethingHandler Handler)
    {
        handlers_ = Handler;
        return *this;
    }

private:
    OnSomethingHandler handlers_;

};

#endif // events_H_INCLUDED

and the class test:

#include <iostream>
#include "events.h"

using namespace std;

class test
{
    int x;
    int y;
public:

    events<int, int> moved{[](int a, int b) { ; }}; //the move event
    test(std::function<void(void)> Created): x(20), y(30)//for the create event i use these parameter
    {
        Created();
    }

    void setx(int s)
    {
        x=s;

        moved(x,y); //like you see, i send argurments to the class and they can be diferent from diferent object
    }
};

int main()
{
    //create the object from test class and initializate the create event
    test a([]()
    {
        cout << "hello world" << endl;
    });

    //lets change, for these object, the moved event
    a.moved=[](int a, int b)
    {
        cout << "moved to: x = " << a << " y = " << b;

    };

    //lest change the x position
    a.setx(100);

   cin.get();
}

i accept sugestions and tips ;)
thanks to all

cambalinho 142 Practically a Posting Shark

the coocckies can make several problems for login?

cambalinho 142 Practically a Posting Shark

i had problems to reset my password.. thanks for you did something for i can enter again
(and i delete the coockies too)

cambalinho 142 Practically a Posting Shark

i'm testing that code in a class:

#include <iostream>
#include <functional>
#include <vector>

using namespace std;


template<typename... Args>
class events
{
public:
    typedef std::function<void(Args... args)> OnSomethingHandler;
    events(OnSomethingHandler Handler)
    {
        handlers_.push_back(Handler);
    }
    void operator ()(Args... args)
    {
        for(auto i = handlers_.begin(); i != handlers_.end(); ++i)
            (*i)(args...);
    }
private:
    std::vector<OnSomethingHandler> handlers_;
    void AddHandler(OnSomethingHandler Handler)
    {
        handlers_.push_back(Handler);
    }
    void TriggerEvents()
    {
        for(auto i = handlers_.begin(); i != handlers_.end(); ++i)
            (*i)();
    }
};

class test
{
public:
    events<> d;
    d.AddOnSomethingHandler([](){
        std::cout << "Hello, World!" << std::endl;
    });
    test()
    {
        d.TriggerOnSomethingEvents();
    }
};


int main()
{

   cin.get();
}

error messages:

"C:\Users\Joaquim\Documents\CodeBlocks\My Class\main.cpp|39|error: 'd' does not name a type|
C:\Users\Joaquim\Documents\CodeBlocks\My Class\main.cpp|41|error: expected unqualified-id before ')' token|
C:\Users\Joaquim\Documents\CodeBlocks\My Class\main.cpp||In constructor 'test::test()':|
C:\Users\Joaquim\Documents\CodeBlocks\My Class\main.cpp|43|error: no matching function for call to 'events<>::events()'|
C:\Users\Joaquim\Documents\CodeBlocks\My Class\main.cpp|43|note: candidates are:|
C:\Users\Joaquim\Documents\CodeBlocks\My Class\main.cpp|13|note: events<Args>::events(events<Args>::OnSomethingHandler) [with Args = {}; events<Args>::OnSomethingHandler = std::function<void()>]|
C:\Users\Joaquim\Documents\CodeBlocks\My Class\main.cpp|13|note: candidate expects 1 argument, 0 provided|
C:\Users\Joaquim\Documents\CodeBlocks\My Class\main.cpp|9|note: events<>::events(const events<>&)|
C:\Users\Joaquim\Documents\CodeBlocks\My Class\main.cpp|9|note: candidate expects 1 argument, 0 provided|
C:\Users\Joaquim\Documents\CodeBlocks\My Class\main.cpp|9|note: events<>::events(events<>&&)|
C:\Users\Joaquim\Documents\CodeBlocks\My Class\main.cpp|9|note: candidate expects 1 argument, 0 provided|
C:\Users\Joaquim\Documents\CodeBlocks\My Class\main.cpp|44|error: 'class events<>' has no member named 'TriggerOnSomethingEvents'|
||=== Build finished: 4 errors, 0 warnings (0 minutes, 1 seconds) ===|
"
why these errors if works fine in function main()?

cambalinho 142 Practically a Posting Shark

thank you.. realy thanks

cambalinho 142 Practically a Posting Shark
template <typename a, typename ... b>
class events
{
public:
    typedef std::function<void( a arg, b ... argx)> OnSomethingHandler;

    events(OnSomethingHandler Handler)
    {
        handlers_.push_back(Handler);
    }


    void operator ()()
    {
        for(auto i = handlers_.begin(); i != handlers_.end(); ++i)
            (*i)();
    }

private:
    std::vector<OnSomethingHandler> handlers_;

    void AddHandler(OnSomethingHandler Handler)
    {
        handlers_.push_back(Handler);
    }

    void TriggerEvents()
    {
        for(auto i = handlers_.begin(); i != handlers_.end(); ++i)
            (*i)();
    }

};

how can i had paramaters to lambda?

i'm trying, but i get errors:

int main()

{

    events my_foo([](int a, int b){
        std::cout << (a+b) << std::endl;
    });


    my_foo(4,5);

    return 0;
}

errors messages:

"C:\Users\Joaquim\Documents\CodeBlocks\My Class\main.cpp||In function 'int main()':|
C:\Users\Joaquim\Documents\CodeBlocks\My Class\main.cpp|46|error: missing template arguments before 'my_foo'|
C:\Users\Joaquim\Documents\CodeBlocks\My Class\main.cpp|46|error: expected ';' before 'my_foo'|
C:\Users\Joaquim\Documents\CodeBlocks\My Class\main.cpp|48|error: expected primary-expression before ')' token|
C:\Users\Joaquim\Documents\CodeBlocks\My Class\main.cpp|48|error: expected ';' before ')' token|
C:\Users\Joaquim\Documents\CodeBlocks\My Class\main.cpp|51|error: 'my_foo' was not declared in this scope|
||=== Build finished: 5 errors, 0 warnings (0 minutes, 1 seconds) ===|"

cambalinho 142 Practically a Posting Shark

why i can't do these?

template <class T, class A>
class events : public T
{
public:
    events(){}
    ~events(){}
    bool operator==( const T& aTee ) const     // Explicit cast
    { return (aTee == *(static_cast<T*>(this))); }
    const T* getTpart() const { return this; } // Implicit cast
}A;

error messages:
"C:\Users\Joaquim\Documents\CodeBlocks\My Class\main.cpp|15|error: declaration of 'events<T, A> A'|
C:\Users\Joaquim\Documents\CodeBlocks\My Class\main.cpp|6|error: shadows template parm 'class A'|
C:\Users\Joaquim\Documents\CodeBlocks\My Class\main.cpp|15|error: template declaration of 'events<T, A> A'|
||=== Build finished: 3 errors, 0 warnings (0 minutes, 2 seconds) ===|"

in these i muse use the 'A' in that place. but why i can't and in normal class i can?

cambalinho 142 Practically a Posting Shark

thanks for all

cambalinho 142 Practically a Posting Shark

imagine the class have 4 functions and both are called inside of class. imagine that you only need call 2 functions. that's why i use empty functions inside of class. and ouside i must override what i need to use

cambalinho 142 Practically a Posting Shark

in these case case i need the 'test'(line 10). my problem is:
if i don't do 'virtual void created(){};', the line 8 will give me an error;
my obejctive is do a padron function and ,if i need, is overrride ouside of class. is what i need.

error messages:

"C:\Users\Joaquim\Documents\CodeBlocks\My Class\main.cpp|17|error: redefinition of 'void test::created()'|
C:\Users\Joaquim\Documents\CodeBlocks\My Class\main.cpp|9|error: 'virtual void test::created()' previously defined here|
||=== Build finished: 2 errors, 0 warnings (0 minutes, 2 seconds) ===|"

cambalinho 142 Practically a Posting Shark
class test
{
    virtual void created(){}; //i must do these.
    //or when i call the function the compiler give me an error

    test()
    {
        void created();
    }
}test;



void test::created()
{
    cout << "hello world";
}

these code have 1 error. but how can overrride the created function?

cambalinho 142 Practically a Posting Shark

ok... imagine these code works and we create the event:

class test
{
    event a(int a);

    test()
    {
        raiseevent a(20);
    }   
};

how can i build the a() function ouside of class?
how can i have sure these event can works diferently for other objects?

cambalinho 142 Practically a Posting Shark

thanks for these forum. i'm learning more here than books ;)
maybe i can do my big objective in next year ;)
thanks to all

cambalinho 142 Practically a Posting Shark
template <class T, class e>
class e : public T
{
public:
    e(){}
    ~e(){}
    bool operator==( const T& aTee ) const     // Explicit cast
    { return (aTee == *(static_cast<T*>(this))); }
    const T* getTpart() const { return this; } // Implicit cast
}e;

can i do these?

cambalinho 142 Practically a Posting Shark

i found the error, you forget ')'. heres the code corrected:

template <class T>
class events : public T
{
public:
    events(){}
    ~events(){}
    bool operator==( const T& aTee ) const     // Explicit cast
    { return (aTee == *(static_cast<T*>(this))); }
    const T* getTpart() const { return this; } // Implicit cast
};

now i need add another function for change the function and another one for call it.
imagine that i create the event in base class, the new class can overrride the the event function?

cambalinho 142 Practically a Posting Shark

i get these errors:
"C:\Users\Joaquim\Documents\CodeBlocks\My Class\main.cpp||In member function 'bool events<T>::operator==(const T&) const':|
C:\Users\Joaquim\Documents\CodeBlocks\My Class\main.cpp|25|error: expected ')' before ';' token|
||=== Build finished: 1 errors, 0 warnings (0 minutes, 2 seconds) ===|"

cambalinho 142 Practically a Posting Shark

for the moment i have these code:

class test
{
public:
    virtual void Created(){}
    test()
    {
       Created();
    }
};

template <typename T>
class events : public T
{
public:
    events(){}
    ~events(){}

};

int main()
{
    events<test> a;
    return 0;
}

error messages:
"C:\Users\Joaquim\Documents\CodeBlocks\My Class\main.cpp|43|error: 'template<class T> class events' used without template parameters|
C:\Users\Joaquim\Documents\CodeBlocks\My Class\main.cpp||In function 'void events()':|
C:\Users\Joaquim\Documents\CodeBlocks\My Class\main.cpp|43|error: 'void events()' redeclared as different kind of symbol|
C:\Users\Joaquim\Documents\CodeBlocks\My Class\main.cpp|35|error: previous declaration of 'template<class T> class events'|
C:\Users\Joaquim\Documents\CodeBlocks\My Class\main.cpp|45|error: 'template<class T> class events' used without template parameters|
C:\Users\Joaquim\Documents\CodeBlocks\My Class\main.cpp|48|error: 'template<class T> class events' used without template parameters|
||=== Build finished: 5 errors, 0 warnings (0 minutes, 2 seconds) ===|"

cambalinho 142 Practically a Posting Shark

see these class:

class test
{
  public:
      void virtual Created(){}
      void test()
      {
         Created();
      }

};


class test1 : public test
{

  void Created();
  void test1(): test
  {
    Created();
  }

} test1;


void test1::Created()
{
   cout << "created test1";
}

(these code wasn't tested, but you get the point)
can i transform the test1 in a template?(continue using the object name like class name)
why transform that in template?
for be more quickly and then i just need created the Created() function outside the class\functions.

cambalinho 142 Practically a Posting Shark

thanks for all to all

cambalinho 142 Practically a Posting Shark

understood. thanks to all. thanks

cambalinho 142 Practically a Posting Shark

thanks for that great information.
thanks
i have 2 questions out off topic:
1 - why they want const be uppercase?
2 - why some people adive me use '{' after function\class name and not in next line?

cambalinho 142 Practically a Posting Shark

thanks for all. thanks

cambalinho 142 Practically a Posting Shark

let me ask you 1 thing:
why the 'PRO's' want avoid the "\n"?
(seems, like you said, the std::endl, is only for '<<')

cambalinho 142 Practically a Posting Shark

error messages:
"||=== My Class, Debug ===|
C:\Users\Joaquim\Documents\CodeBlocks\My Class\main.cpp||In function 'int main()':|
C:\Users\Joaquim\Documents\CodeBlocks\My Class\main.cpp|29|error: no matching function for call to 'console::write(const char [3], <unresolved overloaded function type>)'|
C:\Users\Joaquim\Documents\CodeBlocks\My Class\main.cpp|29|note: candidates are:|
C:\Users\Joaquim\Documents\CodeBlocks\My Class\console.h|163|note: void Console::write()|
C:\Users\Joaquim\Documents\CodeBlocks\My Class\console.h|163|note: candidate expects 0 arguments, 2 provided|
C:\Users\Joaquim\Documents\CodeBlocks\My Class\console.h|170|note: void Console::write(A, B ...) [with A = const char*; B = {}]|
C:\Users\Joaquim\Documents\CodeBlocks\My Class\console.h|170|note: candidate expects 1 argument, 2 provided|
||=== Build finished: 1 errors, 0 warnings (0 minutes, 2 seconds) ===|"

cambalinho 142 Practically a Posting Shark

i understand what you mean. i did that. but let me ask you something:
why i must use 'virtual void print(){}' instead 'virtual void print();'?
if i use the 2nd, the compiler give me an error on Console construtor.

cambalinho 142 Practically a Posting Shark

i want build 1 const with std::endl but by some reason isn't accepted:(

#define NewLine std::endl

i understand the '#define' isn't adviced to be used, but in these case i belive that i can't use the 'const':(
what isn't right with that line?

error message:
"C:\Users\Joaquim\Documents\CodeBlocks\My Class\console.h|170|note: void Console::write(A, B ...) [with A = const char*; B = {}]|"

the write function:

//write
    void write()
    {
        cout <<"";
        print();
    }

    template <typename A, typename ...B>
    void write(A argHead, B... argTail)
    {
        cout << argHead;
        write(argTail...);
    }

so why the error?

cambalinho 142 Practically a Posting Shark

finally i resolve it:

..............
public:
    virtual void created(){}
    virtual void print(){}
    //initializate
    Console ()
    {
        COORD    consize;
        HANDLE hcon = GetStdHandle(STD_OUTPUT_HANDLE);
        GetConsoleSize(hcon, consize);
        SetConsoleScreenBufferSize(hcon, consize);
        created();
        SetVisible(true);
    }
    .................

    //write
    void write()
    {
        cout <<"";
        print();
    }
    ................

and the child class:

class console: public Console
{
    public:
    //initializate
    console(): Console()
    {
        //o que quiseres fazer aqui, provavelmente nada.
        created();
    }
    virtual void created()
    {
        cout << "hello";
    }
     virtual void print()
    {
        cout << "printed";
    }

};

like you see i must call the virtual function in construtor class. because the other virtual function works fine.
1 question:
why i must use virtual void print(){}(empty function) for call it?

cambalinho 142 Practically a Posting Shark

finally i put it to work. but i don't understand 1 thing:
if the console have directive of Console, why Console construtor isn't executed?

cambalinho 142 Practically a Posting Shark

see the code:

/*heres a nice class for work with console commands, properties and events*/

/*#ifndef myheadguard1
#define myheadguard1
//insert contents of header here
#endif*/

#include <iostream>
#include <string>
#include <Windows.h>
#include <conio.h>
#include <sstream>
#include <cstddef>
#include <typeinfo>
#include <stdio.h>

#define MY_BUFSIZE 1024
//#define NewLine std::endl
#define NewLine "\n"

#define BLACK           0
#define BLUE            1
#define GREEN           2
#define CYAN            3
#define RED             4
#define MAGENTA         5
#define BROWN           6
#define LIGHTGRAY       7
#define DARKGRAY        8
#define LIGHTBLUE       9
#define LIGHTGREEN      10
#define LIGHTCYAN       11
#define LIGHTRED        12
#define LIGHTMAGENTA    13
#define YELLOW          14
#define WHITE           15

using namespace std;

struct Position
{
    int X;
    int Y;
};

struct Size
{
    int Width;
    int Height;
};

class Console
{
    private:
    char pszOldWindowTitle[MY_BUFSIZE];
    HWND ConsoleHandle;
    HDC ConsoleDC;
    bool blnVisible;
    bool ReadEnter=false; //these boolean variable is for distinguish the functions used;)

//events
    virtual void Resized(Size SizeValue){}
    virtual void BufferResize(Size SizeValue){}
    virtual void Showed();
    virtual void Hide(){}
    virtual void Cleared(){}
    virtual void Positioned(Position PositionValue){}
    virtual void CaretPositionChanged(Position PositionValue){}
    virtual void MouseClick(int Button){}
    virtual void MouseDoubleClick(int Button){}
    virtual void MouseMove(Position MousePosition){}
    virtual void MouseWheeled(){}
    virtual void MouseHWheeled(){}
    virtual void MouseDown(int Button, Position MousePosition){}
    virtual void MouseUp(int Button, Position MousePosition){}
    virtual void KeyPressed(int Key){}
    virtual void KeyDown(int Key){}
    virtual void KeyUp(int key){}
    virtual void Created(){}
    virtual void Destroyed(){}



    //properties
    DWORD GetConsoleSize(HANDLE sout, COORD& size)
    {
        CONSOLE_FONT_INFO   cfinfo;

        COORD       fsize;

        WINDOWINFO  winfo;

        if (!GetCurrentConsoleFont(sout, FALSE, &cfinfo))
        {
            return (GetLastError());
        }

        fsize = GetConsoleFontSize(sout, cfinfo.nFont);
        if (!fsize.X && !fsize.Y)
        {
            return (GetLastError());
        }

        winfo.cbSize = …
cambalinho 142 Practically a Posting Shark

sorry
errors:(
the construtor must be private?

cambalinho 142 Practically a Posting Shark

thanks for correct me
1 question: the child class can have the same class name?

cambalinho 142 Practically a Posting Shark

i have 1 class:

class class1
    {
       void Created();

       calss1()
       {
          Created();
       }
    } class1;

    void class1::Created()
    {
      cout << "hello";
    }

imagine that i don't write:

void class1::Created()
{
  cout << "hello";
}

i get an error. i try these too:

class class1
    {
       void Created()
       {
          //do nothing
       }

       calss1()
       {
          Created();

       }

    } class1;


    void class1::Created()
    {
      cout << "hello";
    }

i get error too :(
what i want is the class have the Created() function without nothing and can be changed outside of class. can anyone advice me?
(if the question is confuse, please tell me)

cambalinho 142 Practically a Posting Shark

if i build the class in these way:

class classname
{
     //class members
}classname, object1,object2,objectx;

now you can use the class with class name(like a 'static' class) and others objects. now who use these code, don't forget the global variables problems;)
these type of class can't be declared in other place... or you declare the objects before ';' or in other place of code(1 place or another). anotherthing: in other place you can't declare 1 object name with class name.
i hope these help anyone too;)