Home
Blogs
Questions
Jobs
Monetize

Home

About Us

Blogs

Questions

Jobs

Monetize

Post Job

banner

Questions about square-bracket

Read more about square-bracket

python (12.9k questions)

javascript (9.2k questions)

reactjs (4.7k questions)

java (4.2k questions)

java (4.2k questions)

c# (3.5k questions)

c# (3.5k questions)

html (3.3k questions)

Questions - square-bracket

C++ operator overloading [] and return types

I'm just revisiting C++, and I have a question about overloading of the [] operator, and more specifically why my program doesn't work. Given the following code in vec.cpp: double Vec::operator[](unsi...
test-img

Henrik Hillestad Løvold

c++

class

operator-overloading

square-bracket

Votes: 0

Answers: 1

Latest Answer

In this declaration Vec *a = new Vec(2, avals); there is declared a pointer of the type Vec *. So an expression with the dereferenced pointer has the type Vec. So in this statement cout << a[0...
test-img

Vlad from Moscow

Posts

Questions

Blogs

Jobs

The ultimate platform for coders and IT specialists

About

  • Company
  • Support

  • Platform

  • Terms & Conditions
  • Privacy statement
  • Cookie policy
  • Cookie option
  • OnlyCoders © 2025  |  All rights reserved