Jump to content
  • Advertisement
Sign in to follow this  
Beers

COORD in a class

This topic is 5044 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!