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 7723175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:22:39+00:00 2026-06-01T04:22:39+00:00

I´ve got this CRac class and it´s giving me some problems with its members.

  • 0

I´ve got this CRac class and it´s giving me some problems with its members.

//Definition TAD CRac.hpp

#ifndef CRAC_H
#define CRAC_H

namespace bblRac{

struct Racional{
    int num, denom;
};  

class CRac{
public:
    CRac();
    void read();
    void asignarVal (const CRac& otroRac);
    void write();
    void add(const CRac& otroRac)const;
private:
    Racional rac;
    void simplif();

}; //End of class CRac
} //End of namespace bblrac

#endif

In a ccp file I have

#include "CRac.hpp"
using namespace bblRac;

void CRac::add(const CRac& otroRac)const{
    CRac res;
    res.num= rac.num + otroRac.num; //line 98
    res.denom= rac.denom + otroRac.denom;
}

And when I run it, the output is

CRac.cpp:98: error: ‘class bblRac::CRac’ has no member named ‘num’
CRac.cpp:98: error: ‘const class bblRac::CRac’ has no member named ‘num’
CRac.cpp:99: error: ‘class bblRac::CRac’ has no member named ‘denom’
CRac.cpp:99: error: ‘const class bblRac::CRac’ has no member named ‘denom’

I have tried to fix it with the pointer this, but it continues giving the same mistake..
Thank you!

  • 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-06-01T04:22:41+00:00Added an answer on June 1, 2026 at 4:22 am

    This will fix it.

    #include "CRac.hpp"
    using namespace bblRac;
    
    void CRac::add(const CRac& otroRac)const{
        CRac res;
        res.rac.num= rac.num + otroRac.rac.num; //line 98
        res.rac.denom= rac.denom + otroRac.rac.denom;
    }
    

    Your CRac class contains a Racional member variable, num and denom are not members of CRac.

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

Sidebar

Related Questions

Got this in char.h #ifndef _CHAR_H_ #define _CHAR_H_ #include <stdio.h> template <unsigned int TChar>
Got this line of code here but its not working. private void Button_Click(object sender,
I got this class which raises same type of exception, how do i capture
Got this question in an interview today, and its optimized solution stopped me cold
I got this doubt while writing some code. Is 'bool' a basic datatype defined
I got this div... <div tabindex=0 class=button-base inline-block button aw-btn button-base-active> <input type=text tabindex=-1
I got this following method in an non Activity class, My code is below.
Got this code in C#: using System; public class Listener{ public static void Main(){
Got this site with UN/PW set via the Createuserwizard control. Client considers PW too
Got this: Table a ID RelatedBs 1 NULL 2 NULL Table b AID ID

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.