Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6791475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:51:03+00:00 2026-05-26T17:51:03+00:00

i have two classes first: .h file #ifndef Vandenynas_H #define Vandenynas_H #include <cstdlib> #include

  • 0

i have two classes
first:
.h file

 #ifndef Vandenynas_H
#define Vandenynas_H
#include <cstdlib>
#include <iostream>
#include <string>
#include "skaicioti.h"
using namespace std;

class Vandenynas {
public:
    void danne (int i,int a, int a0);
    void getdan();
    string GetName ();
};
#endif  

.cppfile

  #include <cstdlib>
#include <iostream>
#include <string>
#include <sstream>
#include "Vandenynas.h"

skaicioti::v vektorV;
void Vandenynas::danne(int i,int a, int a0)
{ 
    switch (i)
    {
        case 0:
            vektorV.x=a-a0;
            break;
        case 1:
            vektorV.y=a-a0;
            break;
        default:
            vektorV.z=a-a0;
            break;
    }
}

second:
.h file

    #ifndef Zuvis_H
#define Zuvis_H
#include <cstdlib>
#include <iostream>
#include <string>
#include <sstream>
#include "Vandenynas.h"
class Zuvis:public Vandenynas
{
public:
    void plaukti();
};
#endif  

.cpp file

#include <cstdlib>
#include <iostream>
#include <string>
#include <sstream>

#include "Zuvis.h"
skaicioti::v vektorZ;
void Zuvis::plaukti()
{
    cout<<"plaukia\n";
}
void Zuvis::danne (int i,int a, int a0)
{
        switch (i)
    {
        case 0:
            vektorZ.x=a-a0;
            break;
        case 1:
            vektorZ.y=a-a0;
            break;
        default:
            vektorZ.z=a-a0;
            break;
    }
}

and when i compile i get error:
zuvis.cpp(14) : error C2509: ‘danne’ : member function not declared in ‘Zuvis’
maybe someone can tell me where is my mistake?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T17:51:03+00:00Added an answer on May 26, 2026 at 5:51 pm

    I think you need the following:

    1. danne should be virtual,
    2. danne should be declared in the header of the class Zuvis.

    class Vandenynas
    {
    public:
        virtual void danne (int i,int a, int a0);
        void getdan();
        string GetName ();
    };
    
    class Zuvis : public Vandenynas
    {
    public:
        void plaukti();
        virtual void danne (int i,int a, int a0);
    };
    

    The problem is that (1) if you don’t declare danne as virtual in the base class, you won’t be able to present alternative implementation in the derived class (that is, override it), and (2) if you are going to override the function in the derived class, you should say that already at the point of class declaration.

    Alternately, you might want to just overload the function in the derived class. For that case, you don’t need virtual in both cases (though you still need to declare the function in the Zuvis‘s header). That way your function hides the function with the same name in the base class, and doesn’t override it.

    The difference between hiding and overriding can be seen here:

    Vandenynas* pv = new Zuvis();
    pv -> danne(0, 0, 0); // (*)
    

    The line marked (*) executes Vandenynas‘s implementation of danne in the case of hiding, and Zuvis‘s implementation in case of override. Do you see?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Imagine I have two C# files. The first file, Class1.cs contains namespace CrossReferenceCheckingTest {
First I want to describe my situation briefly. I have two classes, one MainClass
I have two classes, and want to include a static instance of one class
I currently have a source file with two classes in it. I'd like to
I have two basic questions. The first one is about function in other classes.
I want to save images in android using SharedPreference. I have two activity classes,
I have two classes, Foo and Bar, that have constructors like this: class Foo
I have two classes that each need an instance of each other to function.
I have two classes: Media and Container. I have two lists List<Media> and List<Container>
I have two classes A and B in two different .NET assemblies: AssemblyA and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.