I'm trying some code with classes but get these errors:

overloaded member function not found in 'Point'
'Point' : no appropriate default constructor available

#include <iostream>

using namespace std;

class Point
	Point(float f_x, float f_y, float f_z);

	float x, y, z;


	cout << "We're in the default constructor" << endl;

Point::Point(float f_x, float f_y, float f_z)
	cout << "We're in the constructor with arguments" << endl;

void main()
	Point myLocation;

Anyone see where I'm going wrong?

Recommended Answers

All 4 Replies

You are passing no parameters to the Point class's constructor. It expect 3 floats, during instantiation (Point myLocation). You need to give it three floats.

You forgot to add Point() constructor declaration in the class Point definition. Do it.

I recognize this code, this is from 3DBuzz's tutorial. :)
You did not declare the default constructor in your class. In other words you do not have declaration for the constructor with no arguments. Watch the 'public section' closely.

Cheers lads. Working fine now

I recognize this code, this is from 3DBuzz's tutorial. :)

It is indeed!! Find their tutorials fairly good

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.