Κώδικας: Επιλογή όλων
// ConsoleApplication1.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;
class CQube
{
private:
string mName;
public:
CQube();
CQube(string name);
void SetName(string name);
string name();
};
CQube::CQube(string name)
{
mName=name;
}
void CQube::SetName(string name)
{
mName = name;
}
string CQube::name()
{
return mName;
}
int _tmain(int argc, _TCHAR* argv[])
{
CQube *point = new CQube();
cout << point->name;
string test = "Makis";
point->SetName(test);
cout << point->name;
delete point;
system("pause");
return 0;
}
Κώδικας: Επιλογή όλων
1>------ Build started: Project: ConsoleApplication1, Configuration: Debug Win32 ------
1> ConsoleApplication1.cpp
1>c:\users\c.\documents\visual studio 2012\projects\consoleapplication1\consoleapplication1\consoleapplication1.cpp(38): error C3867: 'CQube::name': function call missing argument list; use '&CQube::name' to create a pointer to member
1>c:\users\c.\documents\visual studio 2012\projects\consoleapplication1\consoleapplication1\consoleapplication1.cpp(41): error C3867: 'CQube::name': function call missing argument list; use '&CQube::name' to create a pointer to member
========== Build: 0 succeeded,[b] 1 failed[/b], 0 up-to-date, 0 skipped ==========
Ευχαριστώ