Sign in to follow this  
Beers

COORD in a class

Recommended Posts

Ok... im writing a small program IN C++ USING msc++ to get classes down better. The program will be in a dos window (eg. console app.), and am using the "SetConsoleCursorPosition()" FUNCTION, WHICH REQURES A coord. I am wondering if it is possible to create a COORD as a class member variable? So far all of my attaemps have failed.

Share this post


Link to post
Share on other sites
I took out everyhting but the coord for this:

#include <iostream.h>
#include <stdlib.h>

class mammal
{
public:
mammal(){}
virtual ~mammal(){}

virtual void setX(int x) {c.X = x;}
virtual void setY(int y) {c.Y = y;}

private:
COORD c;
};


errors:

error C2146: syntax error : missing ';' before identifier 'c'
error C2501: 'COORD' : missing storage-class or type specifiers
error C2501: 'c' : missing storage-class or type specifiers

Share this post


Link to post
Share on other sites
ok.

The error is, you forgot to include <windows.h>

The other thing is, better use <cstdlib> & <iostream> instead of the .h headers, because these are deprecated.

Thermo

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this