locked
Class in Header file with no implementation RRS feed

  • Question

  • I created a class in Visual studio 2010 in a header file. 
    .h file:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    <dfn style="font-style:normal;color:#500070;">#pragma once</dfn>
    <dfn style="font-style:normal;color:#500070;">#include <SFML/Graphics.hpp></dfn>
    
    <var style="font-style:normal;color:#0000b0;">class</var> Projectile
    {
    <var style="font-style:normal;color:#0000b0;">public</var>:
    	sf::Sprite sprite;
    
    	Projectile(<var style="font-style:normal;color:#0000b0;">void</var>);
    	Projectile(sf::Texture txt, sf::Vector2f pos);
    	~Projectile(<var style="font-style:normal;color:#0000b0;">void</var>);
    };
    

    .cpp file:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    <dfn style="font-style:normal;color:#500070;">#include "Projectile.h"</dfn>
    
    Projectile::Projectile(<var style="font-style:normal;color:#0000b0;">void</var>)
    {
    }
    
    Projectile::Projectile(sf::Texture txt, sf::Vector2f pos)
    {
    	sprite.setTexture(txt);
    	sprite.setPosition(pos);
    }
    
    Projectile::~Projectile(<var style="font-style:normal;color:#0000b0;">void</var>)
    {
    }


    I include the .h file in my main but when I try to use any of the methods of the class they are not implemented meaning they don't do anything. Any suggestions?
    • Moved by Konrad Neitzel Wednesday, July 11, 2012 3:54 PM Off Topic, new thread created in C++ forum already (From:Developer Documentation and Help System)
    Tuesday, July 10, 2012 11:12 PM

Answers

All replies

  • This forum supports the Help System built into Visual Studio.

    For best answers to your C++ programming question, please ask in a topical C++ developer forum, found here:

    http://social.msdn.microsoft.com/Forums/en-US/category/visualc

    Wednesday, July 11, 2012 1:29 PM
  • Thanks, I'm new here sorry for the mess up
    Wednesday, July 11, 2012 3:48 PM
  • Hi,

    I saw that you created a new Thread inside the C++ forum already (thank you).

    I am moving this thread to the Off Topic forum now.

    With kind regards,

    Konrad

    Wednesday, July 11, 2012 3:53 PM