Skip to main content

Representative Line: A Diamond in the Rough

1 month 1 week ago

Mandy's co-worker recently learned about virtual inheritance in C++. It's become their new favorite button to push, and they only use virtual inheritance.

Virtual inheritance is one workaround for the "diamond problem", where you have an inheritance tree that "recombines" via multiple inheritance: when a child class has a Hapsburg-esque parentage, it's hard to decide which inherited methods are being invoked or overridden.

In C++, imagine you have class A, which gets derived into classes B and C. Class D then uses multiple inheritance to inherit from B and C. In practice, this means that D inherits from A twice, and would have two internal copies of all of A's members.

If, on the other hand, you have B and C inherit virtually (class B : public virtual A), then class D will only actually inherit a single copy of A.

If you're reading this and going, "Boy, this just sounds like another reason to avoid multiple inheritance," you're probably right. The important thing, though, is inheriting virtually impacts how your child classes will inherit. It only matters if you have child classes.

Which brings us back to Mandy's co-worker. He read somewhere that defaulting to virtual inheritance all the time was safer, so he did that all the time. All. The. Time.

Including in this case:

class SomeSpecificDerivedClass final : public virtual SomeBaseClass

The class here is marked final. It can't be inherited from. The use of virtual accomplishes nothing.

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!
Remy Porter

FBI Arrests Saudi OpenAI Employee For Planting Recording Device In Conference Room

1 month 1 week ago
An anonymous reader quotes a report from CNBC: An OpenAI employee was arrested after a "sophisticated recording device" was found hidden inside the executive conference room. Abdulrahman Alfozan, 35, who is a national of the Kingdom of Saudi Arabia, was arrested in connection with the matter, the DOJ said. The company said an employee planted the device a few days before it was found, and the Federal Bureau of Investigation "moved quickly to make an arrest," the post said. The employee was terminated. FBI Director Kash Patel said in a statement that Alfozan "allegedly concealed a covert recording device inside his employer's executive conference room to secretly capture sensitive communications about the company's super intelligence technology." Alfozan is also listed as a partner at Raed Ventures, a venture capital firm that focuses on the Middle East and North Africa, according to its website. The firm announced on Feb. 6, 2025, that H.H. Prince Khalid Bin Bader Al Saud, a member of the Saudi royal family, had joined the firm as a venture partner. Alfozan was announced as a venture partner two days later. The Raed announcement for Alfozan lists Meta, Microsoft and SAP as previous roles and said he studied computer science and engineering at MIT. "At this time, we have no indications of this individual inappropriately accessing or exfiltrating model weights, source code, or customer data," OpenAI said in the post. "We take protecting our technology, data and people seriously, and as a matter of national importance."

Read more of this story at Slashdot.

BeauHD